Mobile Development Frameworks

by Aaron 8. September 2010 08:10

Recently, I started learning about Android development.  I watched the five videos on TekPub by Donn Felker.  Great series, as I've already stated.  Because mobile development is something that I'll be moving into at work, I decided (and was maybe urged) to investigate frameworks and technologies that would allow us to develop applications that can be ported easily to Android, iPhone/iPod, iPad, and Windows Phone 7.

I was presented with a short list of potential frameworks that we could look at.  Of the list, two seemed reasonable in that they weren't C++, although none of them supported WP7.  We decided that wouldn't be a problem.  We're great with .NET, so-so with Java, and as I told my boss today, if I had to do just Objective-C, I think I would stab my self in the eyes.

The two frameworks are Appcelerator's Titanium and PhoneGap.  I started with Titanium, but I'm going to talk about PhoneGap first.  It's a shorter monologue.


Let me preface this with, I like the idea of PhoneGap.  They don't try to hide what they're doing, how they're doing it, or what the result will be.  To help the developer create a consistent user experience through the use of HTML instead of attempting to generate layout content for each platform.

You get the source code that the framework generates so that you can tweak, extend, and test.

Sounds great, except I couldn't get the framework to work.  I tested with the example app they distribute with the framework.  Of course the UI rendered in my Android emulators.  After all, it's creating a WebView in the layout and rendering an HTML page from the local system.  But I couldn't get any of the native features to work.  The page is supposed to tell you what version of Android it is, and the fact that it's Android.  It also has some actions that you can initiate like making your phone beep or vibrate.

None of those things worked.  I couldn't find any definitive information that would tell me what was going wrong or what I could try to make it work.  I tried to get it to work by generating the app on my Vista 32 desktop, my Win7 x64 laptop, even on my Linux box.  I tried different combinations of targets when I imported the project into Eclipse, and different emulators.  I tried changing the target in the Ruby script that's used to execute the app generation.

My boss tried it as well.  He was able to get it to work on his Windows VM, but was unable to get it to work on his Mac.  Rather ridiculous if you ask me.

I gave up on it and decided that I didn't want to use something that unreliable.  So that's what I don't care for about PhoneGap: I can't get it to work.


I downloaded Titanium Developer and installed it.  I clicked the shortcut that it put in my Start menu, and was presented with a nice-looking interface.  I said, "sweet!  Titanium has an IDE!" to my 1-year old son.  I was answered with some gurgles, babbling, and a distinct, "no it doesn't."  I don't know how he knew...

So that leads me into the first thing that I didn't care for in regards to Titanium: no IDE.  I did find a language add-on for Notepad++ so you can get some auto-complete features, and there's an add-on for SciTE.  I decided to wing it.  It's just JavaScript right, and we're REAL developers?  We don't need no stinkin' IDE!  It's just nice to have.

This segues into the second thing I didn't care for: it's JavaScript.  I don't mean pieces of it, I mean the whole thing.  Apparently, you can write your own business components and integrate them into your app.  That's great, because I don't want to write all my stuff in JavaScript.  Unfortunately, it appears that the layout has to be done with JavaScript too.  I didn't think that would be a problem.  It's really just a matter of declaring your stuff, setting properties, adding them to your views, displaying your views, and showing all your friends what a marvelous thing you've accomplished.

It's not so marvelous.  At all.  Bringing me to the third thing: no WYSIWYG editor.  Not to say that I need a WYSIWYG, I would just like to see what my layout looks like.  Otherwise, I have to run the app in the emulator each time I want to see the updated layout.  That wouldn't be a big deal, except the layout doesn't work the way I expected.  This becomes time-consuming, especially if you're experimenting with layouts as I was.

I used Donn Felker's "Hello TekPub" application from the first video of the "Intro to Android Development" series as my test.  It's a simple application that has a WebView with a textbox and a button.  A very simple, stripped down web browser so to speak.  It was such a simple thing that I thought I would give it a shot.

I couldn't get the layout to work the way I expected.  Items were absolutely positioned in the center of the emulator screen.  I managed to move the textbox to the top, and set the width of everything appropriately, but I couldn't get a flowing, relative layout.  I even, unsuccessfully, resorted to using a TableView to arrange my elements.  It worked for the textbox and button, but I couldn't see my WebView anymore.

I saw that there's a folder with an Android application folder structure.  I though, "great!  I can check out the generated layouts and tweak those as an intermediate step!"  You can't.  The source that it generates is based on the manifest and some other Titanium stuff.

I gave up.  I spent several hours trying to make the layout work, but I just couldn't do it.  Even if I had arranged the elements on the page to look the way I wanted, I wouldn't have called it a victory.  It was a layout with three elements on it.  Nothing to throw a party over.

After talking to my boss about this, he said that he read most people seem to use Titanium for their business logic, and something else for their UI.  That makes me assume that they're either doing a native UI, or they're using HTML to layout their UI and calling into their custom stuff from there.  But then you're doing it the PhoneGap way.  While your business logic will be native, how do you test it?  You need to make sure that it's going to behave the way you would expect in each environment.  I don't know if you can simply reference the library that it outputs and run unit tests against that or not.

If I wasn't such an impatient cow, I might have continued and then tried a more complicated application.  The platform does support a wide variety of mobile and desktop target platforms.  I think that's fantastic!  The ability to generate a native application for so many different runtimes is very noteworthy.  I get sweaty and exhausted just THINKING about the amount of work behind that.  Unfortunately, I don't think it's a good choice.  You might ask, "good choice for what?"  My answer is, "anything."  Sorry Appcelerator.


Of course there are other alternatives to the two that I discussed here, but I really think that it may be pointless to try to use one framework and codebase to create all of your applications.  The one exception might be the Mono platform.  MonoTouch right now looks awesome for iPhone development, and the concept of MonoDroid seems like a great idea for Android.  I actually signed up for the MonoDroid closed Beta test.  I want to try it out.  I think that it's pretty unlikely to happen though.

For the rest of these single codebase frameworks, I'm not sure where they're appropriate for use.  It might be okay in an environment where you don't have skilled technical people, or maybe small to medium-sized businesses with a lot of disparate mobile devices where the code doesn't need to be solid, air-tight, bullet-proof, full of awesomeness.  I feel they're not going to be good for commercial application development.  Nor will they be good for enterprise development where there's probably going to be more standardized mobile devices throughout the organization.

Maybe for educational purposes?

In the meantime, I'm going to stick with writing native code.

Tags: , , , , , , , , ,


Comments are closed