Smart phones nowadays are much more than gadgets that allow us to do more than a regular phone, they are devices capable of evolving and becoming more than what they were from the day you first started using them. This evolution is possible not only through new forms of software updates (i.e OS, firmware), but mostly thanks to publicly available SDKs (Software development kits) for each device. SDKs allow any person, with enough technical knowledge, to add functionality to a mobile device by developing custom applications for a certain device.
The trend nowadays seems to be becoming, "have a mobile platform?, supply an SDK". And the reason is clear, all platforms/phones want to compete in functionality so why not allow others to build the applications and just provide the means to do it?
Lately I've been looking at (in my opinion) two of the most attractive SDKs for two very popular arising platforms: iPhone and Android. This will be the first of a series of posts where I will try to compare some of the features both SDKs provide. As an end to this short series I will identify SDK components that may be available in one platform but not the other and how they may be key in deciding to program for one or the other or not.
Iphone SDK is based on Objective-C while Android is all Java, so be sure to keep this in mind while following this post and for considering which platform is for you.
The MVC (Model View Controller) implementation:
iPhone and Android both provide an MVC architecture to their programming models. When programming for iPhone you will see that MVC is a huge part of its SDK and specially its documentation. Android's MVC on the other hand is more implicit and less advertised, yet it exists just as well.
iPhone's programming core is composed of views (UIView
) and controllers (UIViewController
). The model are your objects which you organize as you want (OS 3.0 provides the Core Data Framework which is amazing for persisting you model objects).
Views will hold content in your application's window. Almost any object (button, label, table) in your application will be a view, providing different functionality and different ways of displaying data, perfectly following the view concept in MVC.
Controllers are classes that act as delegates for your view objects' events and update your views according to user input.
The MVC paradigm is very well structured in iPhone SDK and allows you to easily plan and architect your application through a very well know pattern in application programming.
When developing for Android your final views will always be controlled by what android SDK defines as an Activity
. Activities are subclasses of the Activity class and are made up, (just like iPhone's UIView) of several other view components which are, just like in iPhone, objects that the user interacts with, with the capacity to generate events and accept user input. The Activity, therefore, works as the controller in MVC responding to events and managing the flow of your views.
Model objects in Android can be managed through the use of ContentProviders which, as part of the Android SDK, are objects used for managing persistent data.
Model View Controller implementation for Android and iPhone as you can tell is very similar and follows the same patterns. They both provide a simple mechanism for responding to user input and managing your different set of views. Whatever SDK you use for developing your next mobile application, if you are familiar with the MVC paradigm, you will feel very comfortable programming with, and if you choose to develop for both you can already tell you will not be very confused.
If you enjoyed this post, in part 2
of this post look at how Android and iPhone SDKs compete by making application collaboration a possibility!