Wednesday 9 November 2011

Update on Sofia Traffic

Exactly one week ago, I wrote about how I created a nice little app called Sofia Traffic, showing in real time the traffic situation in Sofia, Bulgaria.

Looking back, it seems like ages have passed.

Ages.

I have been working on the app something like 3 or 4 evenings of this past week. And now it has very little in common with what I have wrote about seven days ago.

It all started as a quick-and-dirty app to solve my own problem. I have found a technically brilliant API to suck information from and programming the Android UI around it was a breeze.
Except, that very soon I realized that I have hit the limits. The website which's feeds I was using was feeling like being in autopilot -- it didn't seem that anyone was really pushing it forward.

Besides, the information, while technically on a really high level, was not very rich. I was not covering the entire city. If I wanted to add a spot to monitor, say an intersection I know is heavy-trafficked, there wasn't a way to do it.

So at one point I realized that I have hit the wall -- the app was going to stay like this, just a fancy toy which you use for a few minutes and then forget about, because it doesn't really do what you need.

I had only one option -- throw away large parts of what I have written so far and look for alternatives. Fortunately, there were alternatives. I stopped using the feeds and went for a direct (and laborious) HTML parsing from another site. This other site was powered by the service used from the public transportation system in Sofia. They have very rich and very real-time information but they do not have public RSS (or any other) feed.  

In only a few hours I was done and the an update went live in the Android market. The update was offering much more detailed and real-time information than before.

At one point (only a day or two after the update), the app had a rating of 5.0 and the download curve was shaping up like a hockey stick.

Things changed a bit since.

Since now the app was doing some heavy HTML processing and parsing, it was like 3 times slower than before. I gave my best to minimize that, but for this point in space and time, the limits are hit.

And then came a 3-star review with a feedback saying something like 'Users should be able to submit information about the traffic'. Now, I have 9 apps in the market and I am really used to comments like that and negative (or at least not so positive) ratings. Still, it always sucks to have a 3-star rating on your (to that point) 5-star-only app, requesting a feature that has never been promised. This is what I call 'app hijacking' -- you know stuff like 'if this app was doing X, I would give 5 stars' -- and usually I don't give it a second thought. But this one was different -- I knew that if I really want the app to be useful, I must have some crowdsourcing ability.

And again -- a day later (actually an evening later), the app had this ability too. Now every user of the app can submit a signal for a heavy trafficked spot. This signal is processed on my server-side and is valid for 15 minutes. This information then is intelligently merged with the information that comes from the HTML parsing and is presented to the user.

It was far from trivial to do this: adding voting ability with asynchronously posted http requests, having some script on the server to handle them, then use different threads to simultaneously read from the different sources and sync between the results -- all of this was not a walk in the park...

...but was so much fun!

And after this long long post, I think you'll agree with me: ages have passed. Ages.