Building a winning app for Windows Phone

I remember how I bought my first iPhone couple of years ago, iPhone 4. I watched a presentation by Steve Jobs and it was incredible, one of his best presentations: “..And one more thing. We call it Facetime”.  The phone was awesome too; I played with it for seven days non-stop after it arrived. Now I also have a Mac and an iPad.

The language of programming
Since I had quite extensive programming experience on Windows platform, I tried to look into the iOS programming too. It was not difficult. Common programming language on Windows is C#, on iOS it is ObjectiveC.  They are like Norwegian and Swedish: if you know one, then you understand the other. Programming concepts, patterns are the same on every platform. So it was easy, but didn’t work for me. I haven’t created and submitted anything to AppStore. I think I now  know the reason: I let the pleasure last for too long.

Entering a completion
Early in August my attention was caught by the announcement of the programming competition. The task was to build a messenger on Windows Phone 7 platform. By that time I had never held a Windows Phone in my hands. However I knew that WP7 is based on scaled-down version of WPF – main Windows UI platform, which I’m quite experienced in.

A leading social network
The competition was arranged by – a leading Russian social network. It you haven’t heard about it before, you can think of it as Facebook before it became a mess. I walked through technical requirements and designs. First and foremost: deadline was 15th of September. The required functionality was similar to Whatsapp or iMessage: you register or login, find friends, send and receive messages. You can attach photos, location on map. If the app is inactive, you receive push notification, when a message arrives. In addition it should provide full text search in messages history, message forwarding, multi user chat. All the server side already existed as VK platform API, but nonetheless it looked somewhat scary.

As the first thing I bought two books on Windows Phone programming and walked through them in 2 days. I didn’t need to know all the details, only the relevant parts. Books are only part of the picture. The other part is blogs and resources like For example, one common scenario when you have a list of items and you scroll it to bottom and compress a bit to load the next portion of data. There is a common approach to implement it, but not something you expect to find in a book.

The next thing was the phone. I bought one of the entry models, Nokia Lumia 710. It was a good choice, because the performance of the more capable devices is better. Without a phone it is not possible to develop. Simulator is not enough, because it is important to get a feeling of the platform (and WP7 is very different from iPhone), to see how common things are done.

Time Squeeze
I started to work on the project and soon after realized that I may not be in time for a deadline. I recalled that my colleague Adrian Faciu once mentioned that he was interested in mobile development and had some experience with Android platform. I gave him a phone call and he was very enthusiastic about the project. We started to work together.

It was obvious that the messenger should support offline mode. If you don’t have an internet connection, you still can open the app, write a message and send it. It will appear with status “Not delivered”. This implied that we needed to store the data somehow. There is an embedded database available for that purpose, but I had a gut feeling it won’t work. Instead we used plain binary files. Afterwards I looked at the discussion board where our competitors shared their experiences: “What to do: only initialization of database takes 2 seconds??” Our approach worked within milliseconds.

To my surprise we didn’t have any problems with backend API. It just worked: sent messages, delivered instant updates, notifications and so on. Having in mind VK servers workload (millions of users online) it was ..interesting.

I cannot say the same about the programming experience with WP7. Here we had some issues. The most common element of UI on mobile is the scrollable list of data, e.g. list of friends, list of messages. As the user scrolls the list, system creates only currently visible items and the items on the screen below, it never creates all of them. This so called UI-virtualization allows using limited phone memory in a reasonable way. System component responsible for it in WP7 performs badly and has bugs. We had a lot of headache with it and in the end we implemented a workaround, not a proper solution. I’m very curious to see whether it is improved in the recently released WP8 platform.

Frustration and long hours
Working too much and especially during nights makes you tired and can lead to wrong decisions and wasted time. I remember I spent a night making maps appear in messages, something like this:

My first idea was to use a standard maps control. This required just a couple of lines of code, but consumed too much memory if you have many of them. Then I decided to have only one, put it outside of the visible screen area, make a programmatic screenshots and use these screenshots. Then I discovered a bug in WP7, which allowed it only if the original control is visible. So I tried to quickly show, make a screenshot, and hide the control. I went to sleep without making it work. Next day I understood that it was a total nonsense. It took about an hour to get needed picture from Bing maps web service. This is just an example how wrong things can go if you’re tired.

It is important to be a user of your app and be attentive to details. For example, there was no requirement to make hyperlinks in messages working as hyperlinks. But what kind of messenger would it be if you receive a link, and cannot navigate to it?

We actually won!
After submitting our app, I was very sceptical. There were just too many bugs. Some of them were introduced during last two days of development, when we had to work almost 20 hours a day to be in time for deadline. So the results announced two weeks later (1st prize) caught me by surprise.

Now the app is available on Marketplace (Windows analogue of AppStore)

Lesson learned: It’s hard work
When I explore new things, I always want to know the core, the essence of it. What was the essence of making this app to get the first prize? I think it was focus, hard work and correct technical decisions and compromises. And if I were to pick one, it would be hard work.