Having fun with F#, WPF, MVVM, Silverlight, and Windows Phone 7
Posted by Brian on September 25, 2010
Like many developers, in my free time, I like to write code. :) I have my little side-projects, which are typically both fun to play with as well as a chance to learn new technologies. My prior side-projects have typically been small (the two linked in the previous sentence were each less than 500 lines of code), but right now I’m working on a side-project that’s a little more ambitious.
Like many .NET developers, I’m excited about the imminent arrival of the Windows Phone. Here’s a chance to put my existing programming skills and experience to use on a fun new device, and possibly even earn some fun-money selling my app in the marketplace. So that’s what I’ve been spending my free time on of late – a simple-but-fun little puzzle game for the phone. I’ve got about 1600 lines of code now, and I estimate it will come in weighing about 2000 lines – more than I can hack in a weekend, but still small enough to finish in my free time over a couple months.
Along the way I’ve been learning lots more about WPF. I highly recommend the book WPF 4 Unleashed, by Adam Nathan. I’m only about two-thirds the way through the book now, but it’s been very good. I finally deeply understand XAML, and I really now grok and appreciate the WPF architecture and all the terrific-looking UI you can easily create in a small amount of XAML or code. The book is about WPF in .NET 4.0, but nearly everything I’ve learned and wanted to use for my phone app has applied equally to Silverlight for the phone.
I’ve also been trying to wrap my head around Model-View-ViewModel (MVVM) and apply that architecture, along with WPF data-binding, in my app. I’m making some progress here, but think I still don’t have exactly the best factoring and still don’t have enough experience to measure my own success here.
Anyway, this blog post is especially light on content, but I wanted to share what I’ve been up to. Of course, if you want to get started programming for Windows Phone yourself, you should visit the developer web site and get the free tools. And if you want to use F#, get the F# phone templates from the Visual Studio Gallery online. With these tools I found it easy to get started doing game programming for the phone using F# and Silverlight.