My story so far
This is not the first time that I’m attempting to learn app development on the Windows/Windows Phone platform. I’ve tried and failed at least 2-3 times before. I believe the reasons for my failure were:
Lack of resolve in earlier attempts
I was expecting to build something awesome much too quickly. After repeated failures, my expectations are tempered and my resolve is stronger than ever. I don’t expect to achieve ‘flow’ any time soon, but I’m going to keep at it for as long as it takes.
Trouble understanding XAML and WPF
Understanding core OS concepts and the overall platforms goals hasn’t been the issue; but understanding the dense declarative syntax of XAML and ‘richness’ of WPF has been a pain in my dick-hole. I have read a lot of online turials and code samples but my understanding of the language has always remained shaky and sieve-like. Well, this time I decided to stop being a miser and purchase some well-recommended reference text books to augment the search-and-go learning style. I read the chapters, get a better understanding of the core concepts and constructs and then look around to see how experienced developers solve the problems I face.
Unsatisfactory reference material
I feel this still remains a problem but there’s nothing I can do about it. Microsoft puts out a ton of samples and information out, but somehow none of it quite seems to hit the nail on the head (I know I should explain why I feel that way, but I’m stumped). What makes it much worse is that they seem to have iterated so much that the documentation out there is extremely polluted. Adding insult to injury is the fact that they write ballads about WPFs flexibility and the thorough awesomeness of MVVM but half the samples don’t adhere to touted principles. And well, MVVM may very well be amazing for large projects (Microsoft simply cannot think small…pathological problem) but getting started with it is like trying to dig a trench with a salt-spoon. One of the reasons I’ve finally felt okay to point the finger outward is that I’m trying to pick up Java/JS programming to write web-apps at work, and that has been a breeze compared to learning WPF/XAML…I’m probably not the issue here. Anyhoo, I see value in their platform and I just need to stick this phase out till I achieve flow.
Getting stuck in the weeds of design patterns, best practices, scale-able architecture blah blah blah.
Trying to get it perfect the very first time has been a terrible idea and I think I’m finally getting the hang of being a duct-tape programmer. Yeah, I know what Lifehacker says — “Perfect is the enemy of good”, but old habits die hard. And well, abandoning the pursuit for perfection seems so…depressing?
The present condition
I’m currently working on an extremely simple app which I unimaginatively call “Time Tracker”. It’s something I want so I can track which of my hobbies/indulgences are taking up the bulk of my time. I simply want to be able to look back on the month and say how many hours I spent playing video games, programming, working-out, watching porn etc. Like I said, simple.
I bought the book called “WPF 4.5 unleashed” by Adam Nathan to get me moving. It comes with great reviews and I agree that it is a very good technical read. It explains why things are the way they are — not a simple cookbook. It goes into great depth regarding XAML and that has been my biggest learning speed-bump so far. I do rely a LOT on internet searches for cookbook type solutions. Now, Adam Nathan also has a book for Windows app programming but I haven’t bought it because flooding myself with too much reading material may not help either. I’m going to try and absorb as much about WPF from the text, learn tips and techniques from the wide internets and let my bwwaaiins do the rest.
However, one of the most confounding questions for me at this juncture is if I should go with a code-behind approach or adopt a strict MVVM pattern. The decision isn’t easy because code-behind is easy to work with in smaller projects, but it’s messy and I absolutely hate the idea of mixing my data container classes into the UI logic. I’m sure more seasoned programmers would be able to avoid that, but since I’m improvising as I go along I’m liable to fall into a design-ditch. MVVM as a concept makes absolute sense to me. I understand it at an intuitive level but the amount of plumbing you need to put into place for it is a major turn-off.
The other question that bothered me for a while was if I should go with creating a custom UserControl or a DataTemplate. However, this could practically be viewed as another way of asking the first question; and I’ll tell you my verdict in a second.
The plan…
…is to go with the recommended MVVM approach. I.e. I’ll be using a DataTemplate to display a collection of ‘ActivityInfo’ objects with ‘Commands’ in place to update data. The UserControl approach was going to get convoluted because it would end up hosting some activity data within the code-behind which actually is control logic…felt ugly and unintuitive. I might as well spend some time getting this MVVM shit down and do it right, and in a way that makes sense to my brain. When I say “MVVM shit”, of course, I am referring to the basic class infrastructure for Commands, DepedencyProperties, Value Converters and possibly some other things.
I’m really hoping that there is some awesome NuGet package I can download that’ll take care of repeated/standard/boilerplate interface implementations.
Email me when Vinayak publishes or recommends stories