TL;DR; I published my first Windows Phone application to get familiar with the tools. It is a visual Brainfuck interpreter. The code
is published on GitHub. You can get the app
from the Windows Phone marketplace. These series of articles detail my experience switching to the new development platform.
NOTE: THIS IS NOT A TUTORIAL. DO NOT COPY CODE BECAUSE IT IS LIKELY THAT IT DOES NOT FOLLOW BEST PRACTICES.
Part 0 - Visual Brainfuck for Windows PhonePart 1 - The InterpreterPart 2 – XAML and ToolsPart 3 - MVVMPart 4 - Animations
The articles will not quote all the code they refer to. You can view the code
directly on GitHub.
I have been a professional developer for more than five years and in this time I have been working exclusively on (more or less) enterprise ASP.NET applications. In that time I have worked on a couple of Windows Services to do background tasks and a couple of migration tools but other than that I have no real world experience with either desktop or mobile development. I do not like the web as a platform for applications. I really like it as a platform for serving information (Wikipedia style) but it always seemed so wrong to me to build applications using a document format – like programming in doc + VB script for Word. Sadly in the relatively small city where I live there are not many options that pay well and have interesting projects so my whole career kind of naturally swung towards Web development. So I saved some money, quit my job, took another junior level part time job as a mobile developer with a severely reduced pay and I plan to develop some apps on my own. All of this because I do not like developing for the Web… Plus I want to have more time to play StarCraft.
In this series of articles I will detail my experience developing my very first Windows Phone application. THIS IS NOT A TUTORIAL. You should not copy code from these articles because chances are it is not following best practices. It is my first attempt to write code for a mobile platform. I am writing this to document my own experiences and possibly refer to them later. Readers may learn what to expect if they plan to make similar transition. I hope some experts read this and provide valuable advice on how to improve my XAML development skills. The source code of the app
is published on Codeplex under an open source license. You can download the app
from the Windows Phone Marketplace – free, no ads.
is an esoteric programming language that somewhat resembles a Turing Machine. With extremely limited set of instructions and a memory tape with a pointer it is proven to be Turing Complete. Coding in Brainfuck is in fact quite fun although totally impractical. The language can be used to illustrate Computer Science concepts. This series of article assumes some basic familiarity with Brainfuck.
I heard that the problem with Windows Phone was that it did not have enough apps. I searched for Brainfuck interpreters and found only two. Android has a lot more and I did not even check iOS. Obviously people avoid Windows Phone for the lack of quality and versatile Brainfuck interpreters. The better interpreter in the marketplace is called Brainwash
. It has interesting features for debugging and development implemented as extensions to the language. The app is pretty good and costs $1. I wonder how many people except me bought it. I needed a plan to differentiate from the current market leader. The plan was to provide visual representation of the interpretation. My app is not as good for developing Brainfuck programs but it is perfect for watching your creation execute and showing it to friends. Of course the user would be able to develop programs but features like breakpoints and step by step execution are not planned for version 1.0.
Of course the real goal was to develop small but not entirely trivial app for Windows Phone to get me familiar with the tools, the platform and the process of submitting apps before I create more serious app that will hopefully make some money. I developed the first prototype in a weekend and I think this was a reason I underestimated the scale of the project. As someone with experience in software development I should have known better that the finer details are what really take time. I almost fully rewrote the app before I shipped it. I rewrote the interpreter to get rid of the internal thread and the UI to use poor man's MVVM pattern (or at least my understanding of MVVM). It is really hard for me to estimate how much time I spent on this app because when I started it I was still working on my full time job and I dedicated a lot of time to StarCraft II and Diablo 3. My wild guess is it took somewhere between 80 and 120 hours to get the app in a state good enough for the marketplace including the rewrite and writing the tutorials.
Here is what the final app looks like
The user can type Brainfuck code in a TextBox and execute it. Upon execution the tape moves left and right with animation and the values of the cells change. The triangle in the middle represents the pointer and the tape grows to the right dynamically. The user can select a delay to the execution of each step which makes the animations faster or slower. Execution can be canceled. There are premade tutorial snippets and users can save and load their own programs. There are also help page and about page. The app has full support for Tombstoning including running programs which continue from where they left.
I am a bit ashamed to admit that I have very limited experience with unit testing. Microsoft did not help me change this as they did not include the test runner infrastructure in the Express version of Visual Studio. This wrong has been undone in the Express versions of VS 2012 but the tools for Windows Phone 7 are based on VS 2010. During the final stages of development I found out that the tutorials make pretty good test cases and if I start writing this app now I would write the tutorials first and probably even skip actual unit tests.
Speaking of the final stages of development I have observed something really interesting for my mentality towards the end of the project. When release is near I tend to get in a kind of rush and write a lot more code but also reduce the quality. I knowingly copy/paste code and develop against best practices just so that I can see the thing completed. Bugs in the later stages were fixed in a quick and dirty way and changes were not really tested which resulted in more bugs and more fixes. I know this is bad but I just cannot stop myself from doing it. Is it only me or this happens to every developer?
I would like to thank Ivan Hantov and Ivelin Ivanov for helping with the development and putting up with my stupid questions and to Ivelina Georgieva for testing the app (when we are talking about Brainfuck this is a dangerous job).
In part 1
of the series I will discuss the code of the actual Brainfuck interpreter.