you're reading...
Software development

The beauty of being in control of your app data

Here we are a week after the frustrations of bugfixing and recertifying the “Champions League Final” app to the AppHub are Water under the bridge. It’s almost like a sort of a final for me. My app will only be relevant for one day and even though I have tested and tested with live match data, it’s still exciting to see how it goes tomorrow with the amount of downloads far outnumbering my LiveFootie app.

The experiences learnt during the development of this app will be useful in many apps to come. Just the separation of data from the app and put in my own control was even if I do say so myself a touch of genius. Even though it might seem logical to any software architect, I have never been structured in that way in my development. I tend to be more of a labourer type getting the functionality working first, then cleaning up and optimising. This helps to give myself time to look over the code again and rethink the logic and make it better, which would be more difficult if I had organised everything as it should from the start. I like the idea of writing code and see where it ends up. It is truly a creative process like a painting, which may have a clear goal, but can have bumps on the road and end up quite different than was first intended.

So even though I get my data from an external source, I have implemented the logic out of the app enabling me to be able to modify the data along the way and if the feed fails I can manually update this from my service. Obviously this isn’t possible for a whole football league or larger data application, but for my finals app it is a nice way for me to be totally certain that I can deliver the result, no matter what. Apart from if my hosting company has a flood!

But now I would never read a blog like this if there wasn’t some code. So here’s the simple backup that I have implemented in my app:

A simple call to my webapi service.

WebClient fixtureClient = new WebClient();
fixtureClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
fixtureClient.DownloadStringAsync(new Uri("http://webapi.apps47.com/api/livescores/" + leagueIndex));

The webapi exception to enable me to manually update the score.

int HomeGoals = Convert.ToInt32(item.Title.Substring(item.Title.Length - 5, 1));
int AwayGoals = Convert.ToInt32(item.Title.Substring(item.Title.Length - 1, 1));
int ConfigHomeGoals = Convert.ToInt32(ConfigurationManager.AppSettings["ChampionsLeagueFinalScore"].Substring(item.Title.Length - 5, 1));
int ConfigAwayGoals = Convert.ToInt32(ConfigurationManager.AppSettings["ChampionsLeagueFinalScore"].Substring(item.Title.Length - 1, 1));

if(HomeGoals < ConfigHomeGoals || AwayGoals < ConfigAwayGoals)
   item.Title = item.Title + ConfigurationManager.AppSettings["ChampionsLeagueFinalScore"];
   item.Title = item.Title;

See you next week! Happy coding…

About markoo

I am a Dad of 4! Husband of 1! Ex-husband of 1! Developer of Windows Phone apps!


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Enter your email address to follow this blog and receive notifications of new posts by email.

%d bloggers like this: