These days at school, chances are high that your first contact with programming was with C#, just like it was C, C++ or Java years before. Maybe you made some “Hello World!” application for the text console or used WPF to “design” your UI and then do something on a button’s click. That’s all fascinating but you don’t really see why you would put further effort into this. And so the basic C# knowledge sits there in the back of your head, waiting to be resurrected.
One day however – while holding this mobile supercomputer in your hands, equipped with a 1GHz dual core or even quad core CPU and 1GB of RAM – powered by Apple’s iOS or Google’s Android operating system – you might wonder how all these little applications and games are actually being built? You remember that you you learned C# long ago. Is it maybe possible to use the knowledge from back then and create your own little app for the device of your choice? The answer is: YES! There is Xamarin – they promise C# for iOS and Android. You will try it and your little iOS or Android device will reward you with the first mobile “Hello World!”
But what’s next? How to proceed from here? There are thousands of APIs to be explored and millions of possibilities. You will move on and write more complex apps. Maybe you will focus on one platform and make the same mistakes that many beginners make:
- Mix UI code with business logic
- Don’t test your routines and algorithms
- Don’t worry about portability of your code to Android or iOS
What I would like to show you: it is so easy to go the little extra step that will help you to avoid the issues mentioned above. You don’t need a complex framework to achieve this. Just make yourself familiar with the basic principles of MVVM and use the essentials of them when writing your applications.
To show you what can be done with just a little abstraction, I have made a screencast which can be found on YouTube. It will show you how to turn a typical, small iOS app into a testable version that can easily be ported to Android.
You can also find the code for it on Github. Enjoy.