Wednesday 12 March 2014

State of affairs in programming for Mobiles - an opinion!

I think that we are slowly getting used to the fact that most people do most of their work now on non-desktop devices. In fact, on a recent trip away, my laptop stopped charging and I was left to look after server management and a few database bugs on nothing but tablet and phone. Thanks to 4G for that one!

However, as mobile devices (including tablets) become more ubiquitous, this means that developers are having to learn new skill-sets or broaden existing talent. The following information is just a quick summary of information and opinions that I am forming with regard to mobile development.

Choices
When you take on a new project for mobile devices, the first thing that you are likely to have to decide from a programmatic point of view is whether to have a single code base or to write more natively for each device.

To explain: iOS uses the increasingly popular Objective-C as a native language. Whereas Android uses Java. I'm not sure about Blackberry as I have never had any one ask for an app, however, it seems as though c++ would probably be the language of choice for that. The benefit is that you can write straight for the intended operating system and will have full access to the SDKs and APIs that make development easier on those platforms. At present, for the scale of apps that I develop, this is the weapon of choice for me.

Alternatively, you can write non-native code that accesses the APIs indirectly. Perhaps the best example that caught my eye was Xamarin, primarily because it allows you to write code in c#. The obvious benefit is the re usability of code. The write once, use anywhere syndrome that made Java popular. Other companies do have similar libraries (another notable c# entry is DevExpress).

So the question is, why do I still use native code rather than cool 3rd party frameworks that allow you to write a common set of libraries?

Firstly, cost is a big thing. A lot of these libraries ask for large lump sum payments and/or subscriptions. When developing, I am rather scrooge like and will try to get anything that I can for free before I go to the paid option.

Secondly, I am quite thick and I found that with the small amount of time that I have spent on learning native languages vs learning c# for Xamarin or DevEtreme, I actually progressed quicker learning a new language. I find that the Data Access and common tasks are far more simple to learn from the docs of the native languages and I really love the MVC way that Objective-C utilizes! (but that's for another post me-thinks).

Finally, I have bad experiences with write once libraries. Without going too deeply into the reasons (again another post's job), I have found that there are a lot of issues and bugs that you simply don't get in native libraries that transfer to non-native libraries. This is certainly true of desktop equivalents and I have found similar sentiments regarding the mobile libraries that has put me off for now. What I really don't want is to be promised a write once scenario only to have to continually put "if" statements or other conditional branching for each operating system. I actually would prefer to write it all again (but with the logic already in mind) than to do that.

Again, this post is highly subjective and some of you may find different scenarios work for you than what I have outlined above. If you have any comments, please feel free to comment below and tell me where I am wrong.