In this blog post I am going to talk about a program that I wrote, initially motivated and conceived as a consequence of my curiosity to see what my twitting activity had been in the past few months. I was curious to see at what time of the day was I twitting the most, which days was I twitting the most, etc. So I came up with Statwittstics.
In a nutshell what I wanted to do with Statwittstics was to have a dashboard to ask questions about the activity of a Twitter user and do this in a very interactive way. At the time I looked for existing solutions, but none of them seemed to fulfill what I was looking.
Finding a way
I had an idea and I knew what I wanted, but just like with many other things, I didn’t know how to implement any of what I wanted nor I was sure if I should be doing this. Oddly enough I came across a talk from Apple where they go into detail about blocks in Objective-C, a feature that at the time was novel and had a lot of interesting use cases. I watched this talk and was intrigued by the power of blocks, so as I was searching through the catalog of talks in the developer resources at Apple’s Developer Portal, I found a talk about Twitter’s native API for iOS. I watched the talk, what a great talk, and followed along with the examples. As I completed one of these demos the following thought struck my mind:
Hey … I could write that Statwittstics thing in Objective-C, and have it be an iPad app, this in turn might be useful for social media managers who are interested in tracking their “performance” or just for curious users.
I was excited, this seemed an excellent opportunity to:
- Dive into using blocks.
- Doing some relatively simple data analysis.
- Writing an iPad application (I had done this before but never one that was not trivial).
- Having a pet project that I could devote time whenever I was bored.
I kept playing around with the cool things that the API allowed you to do and as I did my amusement kept growing and growing. I was sure that this was going to be the right way to make Statwisttics come to life.
A familiar sounding name
With technical curiosity now being the main driver that I had at the moment, I started looking for ways to take care of the visualization capabilities (my initial intents were rather simple) that I wanted Statwittstics to be capable of. Some googling around lead me to a few projects that were capable of making pie charts, scatter plots, etc, but none that was an actual plotting framework with a well thought API.
Luckily for me a post in StackOverflow lead me to Core Plot, which at the time was hosted in Google Code, this was a great solution. Core Plot was a mature, active and well supported open source project, needless to say, I was extremely excited.
As I dug around some of the examples, I quickly realized that I had read before about Core Plot, and not only that, I had even tried out some of the demos and was pretty happy with them. This was great, Yoshiki from the past had already approved this framework.
I searched for a couple tutorials to get a better understanding of what was going on in the examples, started playing around with some of them and started creating some of my very own plots.
Core Plot is carefully well designed and feels a lot like the way a plotting framework would be structured if Apple authored one. Regardless of this, programming a plot always requires a lot of code, why you ask? Well because if you want to have control of how you want to display the data, you are going to need to customize a variety of parameters, this seemed boring but I kind of embraced it and wrote a set of wrappers to do what I needed, I called it the PBKit.
Assembling the pieces
Now that I had the plotting backend and some of the basic functionality to retrieve twits from a user I knew I had to start prototyping the user interface. At the moment I came up with a really simple one-screen app that would load the data for a user (the owner of the iPad) and plot it.
To start my prototypes I decided to use OmniGraffle, and a set of stencils designed for rapid prototyping of iOS user interfaces. Using OmniGraffle I started thinking more on the type of things that I could add to the screen and the things that would be handy to have so the few things I came up with were:
Main Screen: a simple screen with a summary of the user bio, a plot of the selected activity and some selectors to choose what to plot:
Plot Manipulation Actions: I wanted the user to be able to see what the data that was being plotted was, so I wanted to be able to show a (a) cross-hair kind of thing as the user touched the plot. Alongside with this I also wanted to be able to see the twits that were composing a data point (b):
Statistical Stalking Searching: A new screen would show up if you so decided that you didn’t want to look at your own data but that you instead wanted to look at the data from another user, the first thing you would need to do would be to go to the user menu on the right (a) and then search for the username you wanted to gain an insight into their twitting activity:
In retrospect this was probably the most important part of this project, as I was not very familiar with the available widgets for the iPad iOS and I didn’t really know how would this end up looking; hence I wanted to avoid programming the way Bret Victor defines it:
Programming is blindly manipulating symbols
The birth of Statwittstics
After a couple weeks I came up with a functional version of Statwittstics, it was working, I was able to use it and I was having a lot of fun using it, needless to say it was buggy and rough around the edges. As I continued working on it and adding more functionality (sharing on twitter, selecting which user you want to log in as), I knew there was something lacking, something quintessential to any project: a logo.
I contacted my good friend and graphic desginer Ana, explained her my idea, of course she told me: “You are crazy that’s a weird thing to do …” but she agreed that in some of her spare time she would work on a logo for Statwittstics, I was thrilled and excited. The result:
After a couple weeks I had already finished the initial prototype with all the functionality that I wanted, the program was “stable” and was usable. I was extremely happy with it. See for example the implementation of the main screen at an early stage:
And then an updated version a couple weeks later, with a few extra controllers:
And of course we had to be able to share these sweet plots on twitter so hence the following:
And this is how searching for a user looks like:
If you are curious about this and more, I’ve made the code available on GitHub, you can find it here:
I encourage you to try it out, depending on when you try it out, you might find that some settings in Xcode have changed so, please let me know if this is the case so I can update this.