It doesn’t take much to sending me on a coding spree. Sometimes is something as simple as an idea that I need to implement now since it fundamentally changes the way the application will evolve and other times it’s something right out of the blue. Last night was the latter as after finishing up some preliminary packing for my trip to the US on Sunday (stay tuned for pictures, posts and vlogs!), playing a couple games of Starcraft 2 I found myself watching the latest episode of the Random Show. In essence it’s just Tim Ferriss (4 Hour Work Week) and Kevin Rose (Digg founder) talking about all sorts of things, but a common theme is always that of entrepreneurship. As someone who’s aspiring to that lifestyle I’m usually fixed firmly to the screen, hoping for some gems that will help me along my merry way. Last night however provided something completely different.
After listening to them for quite a while I looked down at my notepad with a list of features that I’ve slated for integration into Lobaco. I’ve deliberately let them go by the wayside as feature creep is the easiest way to kill a product before it even gets off the ground. Couple that with the fact that I only just recently had the penny drop on iPhone development the less ambitious I make the first iteration of the product the more likely I am to make it solid and usable, rather than a total mess of half done features. Still there are a couple on there that are wholly web client based so feeling the entrepreneurial surge from two web start-up powerhouses I thought I should go ahead an knock a couple of them over.
Boy was I in for a surprise.
One feature which was easy and would make the UI slightly more complete was making the right hand side information section scale dynamically with the browser’s height. In essence this is so you can see more if you’ve got a larger screen and makes the UI look a bit better on smaller screens. Since Silverlight supports dynamic height scaling by simply not specifying a height I thought that all I’d need to do was remove the static height and I’d be done, leaving me to knock over another feature before bed. Changing the property lead to the list box scaling out to its full height and refusing to show a scroll bar, and left me scratching my head as to what was going wrong.
Diving into the code I noticed that whatever I set the height to in the class file would determine the height of the list box. Thinking that it would just be a matter of setting that to the available height would give me the behaviour I wanted I coded up a loop that set that height whenever the size of the browser window changed. This kind of worked but never scaled properly, despite my beautifully crafted logic statements. Something was definitely amiss, but it took me another 2 hours to track down what it was.
Essentially it was a clusterfuck of 3 different coding screw ups. The first was placing the custom class I had designed inside a list box, which was in essence wrapping itself in itself. The second was actually using that class in the first place as it was not required and also duplicated a ton of styling logic thanks to the way Expression Blend messes with your code. Lastly, instead of adding items directly into the list box itself I was creating yet another list box, adding items into that and then adding that entire list box into the main list box (which was wrapped in yet another list box). To get dynamically scaling height in that mess would’ve required setting the height in about 3 different locations consecutively, an expensive process for something that’s supported natively.
The thing is this component was one of the first things to be coded into Lobaco about 3 months ago so this issue has been there almost from day dot. I’ve looked at that code dozens of times over the course of developing this application and not once did it twig that was I was doing was completely ass backward. It’s been almost a month and a half since I did any serious work on the web client and it seems that time away has given me enough perspective to see those obvious mistakes. I think that all developers need time away from their projects in order to get their head out of the problem space and get a clearer perspective on what they’re doing. Hell I’d say that those breaks I took from developing Lobaco were wholly responsible for the 3 code dumps I did and the current polished version that’s on the web today.
In the end the whole development process has been one of the most gratifying learning experiences I’ve ever had. It seems every time I think I’ve got things down pat I learn something new that makes me rethink my past decisions, tweaking things so they’re just that little bit better. Whilst I’m sure that this code base is here to stay it’s definitely evolving as time goes on as each change builds upon the last to provide a better experience for my future users. I won’t be making any progress on it for the next month whilst I travel the US but I’ve got the feeling in that time I’ll get enough perspective to make some incredible changes to Lobaco and hopefully I’ll come back recharged enough to hit development with renewed vigour.