Maximizing your DROIT, or: why you should learn HTML5, CSS3, and JavaScript for mobile development.

As a developer you have one resource that is more valuable than any other. It is also the scarcest resource you have. That resource is time.

Given such a limited and valuable resource, you should be looking to make the most of how you invest it. In other words, which tools and technologies should you devote this limited resource to learning?

If you want to develop on mobile devices, you have a plethora of choices: do you invest time, like I did, into learning Objective-C and Cocoa to develop native applications for the iPhone? Or do you devote that same time into learning Java to develop for the Android? Or do you devote that same time instead into learning C++ and some proprietary framework that will only let you develop for Samsung's upcoming smartphone platform?

The question you should be asking yourself as a developer whenever you decide to invest your most valuable resource is this: how much of a return can I get from this investment? In other words, you need to calculate your Developer's Return on Investment on Time (DROIT).

Developers considering ROI, has the world gone mad?

These are not the DROITs you're looking for

Here's a very simple guide to help you decide whether or not you should invest time in learning a new tool, technology, or platform:

Seek: open standards and open platforms.

Avoid: proprietary platforms and walled gardens.

Let's examine why proprietary platforms and walled gardens constitute bad investments of your time and why open standards and platforms are the logical alternative.

Avoid: proprietary platforms and walled gardens

A proprietary platform is a platform that is developed and controlled by one (or primarily one) commercial entity. While there may be short-term economic incentives for learning and developing on proprietary platforms (for example, the evangelizing company may offer economic incentives or run high-cash-prize contests, or there may be lucrative enterprise contracts), their long-term return may be less certain. More dangerously, you will be locked into developing for a single platform and may have a harder time re-using your knowledge elsewhere. And what if the company in question decides to abandon the technology or stop investing in it?

Case in point: say you decided to learn the proprietary platform that Samsung is building for its next generation of smartphones. You cannot use those skills to develop for the iPhone or Android devices (or for the Web, or for desktop applications). This is a bad investment with a very low DROIT. This is one of the reasons why Samsung will fail dramatically in smartphones – they don't understand developers or the importance of maximizing DROIT.

Semi-open and Openwashing

Unlike Samsung, most companies with proprietary platforms are usually well aware of how unattractive lock-in can be for developers and this is why they often to embrace – at least superficially – open standards. Of course, just because a platform supports XML or some other open technology or standard, it doesn't mean that the platform is open. Most proprietary platforms feature some degree of Openwashing wherein the owners of the platform go to great lengths to make the platform appear more open than it truly is. Adobe did this for a long with the Flash Platform, stating that SWF was an open standard while actively barring anyone else from creating a Flash Player (this has now changed, and the SWF format has truly been opened up but its development and future direction are still primarily controlled by Adobe.)

When in doubt, of course, prefer proprietary platforms that do support as many open standards as possible to increase the reusability of your knowledge and maximize your DROIT. So, a good rule of thumb is:

Prefer semi-open over closed.

But there's an even better rule:

Prefer open over semi-open or closed

Open standards, technologies and platforms – by their very nature – offer you the highest DROIT.

As a developer who wants to maximize her DROIT, you owe it to yourself and your career to invest time in learning these open technologies. The advantages of open over closed are the following:

So, as a developer looking to enter the exciting world of mobile development, what technologies should you learn?

Based on the simple guide, above, and on a desire to maximize your DROIT, the answer is plainly clear:

Learn HTML5, CSS3, and JavaScript

The web is the best example of an open platform that we have today. It is the antithesis of a walled garden: you can deploy what you want, when you want, and don't have to ask anyone for permission.

While iPhone developers wait months on end for a response from Father Apple, you can deploy dozens of apps to the web without hassle.

And the technologies of the web, open standards all, have the highest reusability of any technology to date. Perhaps the saying should go: Learn HTML, CSS, and JavaScript and you shall never go hungry.

"But, Aral," I hear you say, "surely there are drawbacks to building apps using web technologies."

"Surely someone like yourself, with such a strong focus on User Experience, should understand that it would be untenable to create experiences using such generic technologies that match the experiences possible with native tools and technologies on mobile platforms."

Thus, surely, an iPhone web app must offer a lesser experience than the same app built using Objective-C and Cocoa Touch. Thus, surely, we must embrace the Lowest Common Denominator and sacrifice UX if we develop using cross-platform technologies.

Not at all.

Embracing Write Once, Compile Anywhere, not Write Once, Run Anywhere.

The ability to re-use code and easily port your applications between platforms and devices does not imply that we take a Lowest Common Denominator, Write Once, Run Anywhere (WORA) approach to UX.

Write Once, Run Anywhere has long been seen as the Holy Grail of software development. Sun promised us this elusive ideal years ago with Java and failed to deliver on it. Flash managed to deliver it across browsers and operating systems insofar as the web was concerned but Adobe then decided to embark on a futile mission to replicate this success across desktop applications and mobile devices. And browsers – and HTML, CSS, and JavaScript – were, and continue to be, criticized for failing to deliver on this due to the many browser incompatibilities that plagued developers in the early days of the web before we had better standards support in browsers and JavaScript libraries like JQuery that abstract out the more painful inconsistencies in the DOM.

But what do we mean by Write Once, Run Anywhere in today's world? And is it even a goal worth having?

No, it's not.

Not as the term has traditionally been understood in any case.

Defining Write Once, Run Anywhere (WORA)

Write Once, Run Anywhere implies that you create an application once and it runs the same way (or similarly) on anything. If you're Adobe, pushing Flash, "anything" may include the Web, desktop, and mobile devices.

If you have any understanding of User Experience, you will instinctively realize that regardless of whether or not WORA is technically attainable, it is definitely not a desirable goal to have as far as the user experience is concerned.

User Experience is about focus and optimization. You cannot write a web application and have it be a great user experience on the iPhone, for example, without optimizing the user experience for the iPhone. Optimizing in this sense of the word doesn't just mean scaling your interface down to fit within the dimensions of the iPhone's screen. It may mean having to completely recreate the UI of your app, including user gestures and interactions, to give your iPhone users the best possible experience on their device.

The same goes for when you want to run that same application on an Android phone or the Palm Pre. Where the changes may be less pronounced than those required to go from Web or Desktop to Mobile, the difference in feature sets and operating system expectations between the devices will require UX optimizations that may dramatically affect the structure of your user interfaces.

So while you can port an application that uses open web technologies across platforms and devices, you must still optimize the User Experience for each platform and device that you support. I won't downplay the importance of this: it may mean that you have to do a lot of work and invest a lot of time and money into altering your user interface radically to best support the unique features of the platform or device you are supporting.

However, it will mean that you do so without changing technologies and without changing your entire codebase (this is where maintaining a clear separation of concerns between your View and Model begins to pay real dividends.)

Even though Write Once, Run Anywhere is undesirable insofar as UX is concerned, it doesn't reduce your DROIT in open technologies. While the re-usability of your applications may not extend to the UI layer (or may apply less to it depending on how similar your various target platforms are), it will still apply to other parts of your application.

Using open technologies will make it easier to port your applications across platforms and devices. This does not mean, however, that there is a magic bullet that will make your applications usable on every platform. The concept of Write Once, Run Anywhere is a relic from the Age of Features that has no place in the Age of User Experience.

But what about the argument that applications built using web technologies cannot be as optimized for UX as native applications?

In a nutshell, it fails to hold water, and brings us to the alternative to WORA.

The alternative to WORA: Write Once, Compile Anywhere (WOCA)

There are currently a plethora of tools and technologies – both open and closed – that allow you to re-use your DROIT in open technologies to build native applications across various platforms without sacrificing UX. In fact, this is one the most exciting trends of our time and one of the reasons why it's a great time to be a developer.

Examples abound: the open source Phonegap framework, for example, lets you build applications using your existing DROIT in open web technologies while compiling your app into native applications on iPhone, Android, and Blackberry.

And it's not the only one. Check out Titanium and Appcelerator, and also look at web frameworks like iUI, xUI, Magic Framework, and JQTouch – all of which increase your DROIT.

Commercial and proprietary platforms are also embracing WOCA. Adobe, for example, realized that WOCA was the way to stay relevant with the iPhone and their upcoming Flash IDE in CS5 allows developers to create iPhone applications by re-using their DROIT in the Flash IDE while outputting native iPhone apps. (I hope Adobe wakes up and realizes that it has a far brighter future if it focusses on its development tools and native compilation with WOCA instead of spending time and money on trying to get native support for Flash on devices. Flash support in mobile browsers is necessary for a faithful rendering of today's web but native Flash support for applications adds absolutely no value to a platform.)

(Another proprietary WOCA solution to keep an eye on is Unity3D.)

Beyond WOCA: Palm leads the way with WebOS

The WOCA solutions we have today are a wonderful way of increasing DROIT in open web technologies. But mobile platforms can do better by actually embracing web technologies as first class citizens on their platform. (Not as crippled subsets like Apple's initial foray on the iPhone.) In fact, one company is already doing that and doing it beautifully.

While Microsoft drifts aimlessly with Windows Mobile trying to play a fruitless game of cat and mouse with Apple, and while Google – the defender of all things open and web – invests in Java with Android, one company has come out of left field with a solid vision to embrace open web technologies for its mobile platform. That company is Palm and its platform is called WebOS. And you should stand up and take notice because it is one of the most important developments in the mobile world today.

With WebOS, you don't need to compile your HTML, CSS, and JavaScript to native applications because they are the native technologies of the platform.

Beyond supporting open web technologies, Palm also supports the ethos of the Web. You are not bound to Palm's store (even though they have one) and can deploy your apps to the web without asking permission from anyone. (If you do want to use their store, you can do that also and get the best of both worlds – the impulse buys and worry-free purchasing that the store provides coupled with the freedom to also distribute your apps yourself.)

More than that (and this is a personal point), having been to the Palm developer event in London recently and met Dion and Ben (who head up Palm's developer relations), I have to say that Palm has some genuinely nice people working for them. I love their approach and their vision. They have hired developers who have contributed to the open web and believe in its future. In other words, Palm has the right people running the show. And I wish them all the success.

(And this has nothing to do with the fact that they gave me a free Palm Pre to play with. In fact, if anything, I find it unfortunate that the hardware of the Pre doesn't allow the software and Palm's vision to shine currently. But it is a Version 1.0 phone and I look forward to seeing how the hardware evolves with the Palm Pixi.)

In conclusion

As a developer, your scarcest resource is time. It is thus of paramount importance that you invest this time wisely in learning the relevant open web technologies of today – namely HTML5, CSS3, and JavaScript – in order to maximize your DROIT.

Thanks to WOCA solutions like Phonegap and native web platforms like Palm's WebOS, you no longer have to sacrifice either your investment in open web technologies or your commitment to creating great user experiences. In other words, you can have your cake and eat it too!

Bon appetite!