Just as in the ’90s, there’s a bunch of hype these days around solving the cross-platform development problem. Mobile platform fragmentation is killing developers, and if only every device supported some common language or technology engine we could all Write Once and Run Anywhere.
If only.
WORA was, is, and always will be, a fallacy. WORA reminds me of the mole in whack-a-mole. It just keeps popping up and the realities of competing platform vendors keep whacking it back down. What drives me crazy is not the “Run Anywhere” part that most people throw out and replace with something else (like “Optimize Everywhere” , “Suck Everywhere”, “Test Everywhere”, or “Outsource the optimization“).
It is the “Write once…” part that’s the most dangerous. We all wish the world was rainbows and unicorns, and “Write once…” implies that there is a world where you can actually write an app once and it will run on all devices. But this is precisely the fantasy that the platform vendors will never allow to become reality. Stop asking for it.
“Mobile fragmentation is going to get significantly worse over the next few years. While this fragmentation will be bad for end users in some cases, it will be particularly bad for developers.”
– Me on LockerGnome, Oct 22, 2012
HTML5 is awesome in many ways. If applied judiciously, it can be a great technology and tool. As a tool, it can absolutely be used to reduce the amount of platform specific code you have to write. But it is not a starting place. Starting with HTML5 is the most customer unfriendly thing a developer can do.
“We start with the customer and we work backward” – Jeff Bezos
“… you gotta start with the customer experience and work backwards to the technology.” – Steve Jobs
Like many ‘solutions’ in our industry the “Hey, write it once in in HTML5 and it will run anywhere” story didn’t actually start with the end-user customer. It started with idealistic thoughts about technology. It was then turned into snake oil for developers.
Not only is the “build a mobile app that hosts a web view that contains HTML5” approach bass-ackwards, it is a recipe for execution disaster. Yes, there are examples of teams that have built great apps using this technique, but if you actually look at what they did, they focused on their experience first and then made the technology work. What happens when the shop starts with “we gotta use HTML5 running in a UIWebView” is initial euphoria over productivity, followed by incredible pain doing the final 20%.
The problem is each major platform has its own UI model, its own model for how a web view is hosted, its own HTML rendering engine, and its own JavaScript engine. These inter-platform differences mean that not only is the platform-specific code unique, but the interactions between that code and the code running within the web view becomes device specific. And to make matters worse intra-platform fragmentation, particularly on the platform with the largest number of users, Android, is so bad that this “Write Once..” approach provides no help.
Developers really want to believe it is possible to “Write once…”. They also really want to believe that more threads will help. But we all know they just make the problems worse. Just as we’ve all grown to accept that starting with “make it multi-threaded” is evil, we need to accept “Write once…” is evil.
There is no “Write once…”. I wish there were. I know you wish there were too. But I wish my daughter had a baby unicorn to ride too.
There is, however, “Focus on creating the best possible user experience on each device and try to get as much code re-use as you can along the way.”
Focus on the experience, try to get code re-use.
Not as catchy, but far, far, more realistic. And helpful.
Edit: February 22, 2013 – Shortened title to make it less inflammatory.
Lousy headline. And you wrote it yourself. Bummer.
That people want to believe “Write Once,” and are pandered to, is hardly the fault of Gosling for inventing a programming language and virtual engine for (originally) small devices. It is the case that having a common VM to run anywhere is not the same as UI universality, especially now. Even if Gosling proposed that slogan, that was then and this is now. And I bet a lot of enterprise employment of Java is perfectly satisfactory for the platform-substitution assurance it provides.
Listen, James Gosling is actually a hero to me. He had a bold, bodacious technical vision and he made it happen. Great things have happened as a result. Billions of $ have been made. Many developers learned to program with a language better than C++ to learn on. Much of his original thinking has inspired others to do more great and bodacious things.
However, his creation also created a faulty mindset. He encouraged that mindset. I know he didn’t actually coin the term, but I was around and I heard him speak. He toed the party line. Using his name is relevant to this discussion because, I believe, it highlights the problem: The “write once” approach is faulty.
> that was then and this is now
And now, iOS app development is the center of the f’ing universe because it’s the total opposite of WORA.
Nothing succeeds like success.
Could not agree more. As a CTO I have been confronted by people saying “we should just make it all HTML5, forget wasting our time writing native iOS apps”. Sometimes I’ve walked out of the room, sometimes I’ve wanted to assault people. They don’t get it. If your requirements call for a mediocre hum-drum experience that is identical across multiple devices, maybe you should consider cross-compilers or HTML5 “app jails” .. but every customer I’ve ever written an app for has deserved better. Build what people want, what they crave, what keeps them addicted, what created raving fans … not what makes developers happy.
I got some feedback (on HN) that my post may not be as clear as I’d hoped. Here’s what I wrote over there to help add more flavor:
The best products in the world are those created by organizations that start with the customer. Everything they do starts with customer needs, pains, desires. They work backwards from that. Eventually they decide what tools & technologies to use to deliver greatness to the customer.
Write Once… encourages a mindset that doesn’t start with the customer, but with a technology. Instead of focusing on the features & capabilities that matter the most to the customer, the focus is on something like HTML5 (or Java).
The best products result from focusing on really delighting the customer by doing a few things really, really well. Given mobile platform fragmentation one axis where this is critical is what platforms to support initially. WORA (esp HTML5) leads to a mindset where it’s important to get the experience running on many devices simultaneously; the ‘focus’ is on doing a crappy job across many things.
I’ll repeat what I said in the article here: I don’t hate HTML5. I code HTML5 almost every day. The product I launched on Monday makes heavy use of HTML5. But only because our customer value proposition led us to the need to build a website, and we had capabilities that needed to be highly interactive. HTML5 is a great technology that addresses this.
The summary: If you must target multiple platforms, focus on the experience; then try to get code re-use. Don’t do it the other way around.
Although the message is OK, the tone of your blog post is rather trollish. You could replace your post with your own comment and then it would make much more sense.
You are only speaking about front end. And there yeah, as input devices change and evolve UI should too so no “Write once…” there and never will be.
But underlying tech, engines, services, frameworks change less. And should actually be standardized eventually…
I would say that real meaning of this saying for me is “Don’t invent a bicycle”.
So yeah build custom interfaces for different platforms, but building different middle ware and back end for different platforms?
Write once is meant for cases when thing that work good already exist, no point in reinventing the wheel. Actually in html design there is a style of calling uncalled for use of something like divs as a divitis. I guess it implies it as a sickness. Well for young programmers there is this “write from scratch”itis. They want to write from scratch in all and every case even when very good, widely used tested an documented solution already exists.
All in all its not so simple and there is lot of things to consider but I guess aim of your posts actually is at those who blindly prefer to write once even when its a bad idea.
> But underlying tech, engines, services, frameworks
> change less. And should actually be standardized eventually…
No, they won’t be standardized. The Mac API is copyright Apple, the Windows API is copyright Microsoft. Standardizing would be like forcing Lady Gaga and Pat Boone to sing the same song catalog. Not only do Lady Gaga and Pat Boone not want that, but their listeners do not want that, and it is not good for anybody.
If both Mac and Windows run the same app, then Apple cannot innovate, they can only move as fast as Microsoft moves (very slow.) One of the reasons to buy a Mac is Auto-Save/Versions — Mac apps do it, Windows apps don’t. There are 1000 other examples of Mac API features that give a user 1000 other reasons to buy a Mac as compared to a Windows machine, and result in the user being exponentially more productive.
The standardized API is HTML5. That is the exception to the rule. Having one way of reaching everybody is worth the loss of quality in the context of the World Wide Web. But the native API’s track 5 to 10 years ahead of HTML5, and probably always will, because the standardization process takes years. Apple decides to do something with iOS and they do it, no waiting.
Are you developer yourself? It just that from what you said I have some doubts.
First example of reuse are programming languages themselves, its especially true for server side stuff as no meter what client/ui/device is server side service is(or at least can be) the same.
Its best example. Let’s say Facebook which say has at least 4 versions of its UI, desktop web, mobile web, and two native mobile apps, probably more. Yet its back-end is same database, same server side.
Though its not strictly speaking “write once runs everywhere” as it runs on the server side only.
Yet still lets take purely native clients. And lets take what’s called middle ware. Well I don’t have direct experience with say object-c stuff but even there as far as I know cross platform C libraries for common complex problem solutions are used.
Like say physics engines for games. Those truly are write once run everywhere, but in a form of written once, and then compiled/porter everywhere. Which sometimes is not as easy as just “write once runs everywhere”.
Say there is popular library for face detection which I seen working in google native client in browser, i bet it can run on server working with any server side language(well with some work to make communication work), it is sued in native phone apps, obviously in desktop apps, and most crazy thing I seen to date is that its compiled to Adobe Flash trough Adobe alchemy project and works there o_0
Still probably the easiest example is something like 2d physics engine for games called Box2D. Its variations are used in all platform,s languages etc etc etc. Its origin is C, its most popular engine for Flash games, it has few JavaScript ports and even such platform selling games like Angry Birds use it across all platforms Angry Birds was made for. This is kind of project I was talking about.
So in the end, large open source libraries for solving complex problems are truly written once, but when it comes to “run everywhere” things sometimes are little bit more complex, as say with javascript without native client of google we end up porting/rewriting it, but in a sense it still is the same, just in different language, so kind of written once but then translated sometimes to run everywhere.
The thing is, on servers they more or less managed to make this a reality. Or at least, there are standardized Java web- and compute-server environments that a pretty widespread in use. They can get away with it by basically abstracting the hardware as TCP/IP + CPU + RAM + Filesystem.
Everything can be made to work on servers, because the servers are maintained by nerds. The complaint here is about client apps and their brutal interfaces, and the way that programmers ignore those problems because they prioritize themselves over the users, and want to program in a certain language even if that language is not appropriate for their app.
‘Write Once, Run Anywhere’ was not coined by Gosling, Sun, or anyone involved with Java. It was a phrase they borrowed from the Smalltalk community.
Thanks for pointing that out. Of course I knew Sun was not the first to use the term, but you’d have to agree they popularized it.
Man, most of the threads of this post have it wrong. You can’t blame Gosling that people choose to design a UI once and expect it to work an multiple devices. Sheeeesh. Java in the enterprise and financial markets is very heavy in use and the WORA model works great – a lot of developers write their code on Mac or PC and deploy to linux servers, for example.
Go take a chill pill.
The article is specifically about client app interfaces, not about faceless Java server apps.
Many developers also write PHP on Mac and deploy to Linux. So what?
That’s exactly the problem. It’s a completely fallacious strawman argument to say that because of Java and WORA, UI developers have decided to ignore platform specifics, especially when Java isn’t even the language being used. To make this argument you have to prove a direct connection between Gosling and mobile UI developers but you can’t.
Only HTML + CSS. For all screen size! Browser Only!
Example: http://www.1computer.info/1work/1work_demo_en.html
Not use JavaScript, not use Java, not use Flash Player, not use plugin
When you use HTML+CSS you are also using JavaScript. What you think of as a “pure CSS rollover” is just the browser doing the JavaScript for you.
HTML+CSS+JavaScript is all one thing now, called HTML5. That is the API that is in your browser, running every page it shows.
100% agree with this .. let the platform shine and let devs take advantage of that !
A lot of .NET devs are crying out for a true WORA solution for windows platforms (WinRT/WP8/SL/WPF) …
I hope that MS and the .NET team are not trying to strive for WORA but rather portability that makes sense. I want to share code BUT I also want to be able to target a platforms strength, which could mean unique apis for that platform..
You have *completely* missed the point. Write Once Run Anywhere does not mean Write Once Look-and-feel-the-same Anywhere. Any decent programmer can make code which is more abstracted/generic look and feel like native code on each platform it is deployed to be that with Java, HTML5 or any other cross-platform technology. Clueless troll.
No, you missed the point. The point is that users are tired of apps that look native but do not act native. And even if a developer is outrageously talented, there are too many variables beyond his or her control. For example, an operating system update that changes the native controls slightly, and now your cross-platform native-imposter app is all messed up.
If what you say were true, this article would not even exist. The author would just be happily running cross-platform apps that look like native apps without even realizing there is such a thing as cross-platform apps.
HTML5 is the exception to the rule. The Web is designed to be a common meeting place for everyone on the Internet. The cross-platform nature of HTML5 is its primary feature. As such, we put up with its crapulence. But outside of the Web, there is no excuse for not using the right tool for the job, i.e. Xcode and C code to make iOS apps. Even if you prototype in Flash or something, hiring a C developer to make the real app will pay for itself in additional quality and sales.
If you are right, how do you explain how crappy mobile Java and Java/Android apps are compared to iOS apps, which are C?
Nice response JD.
Much of what you say is true, especially the apparent fact that platforms have emerged in recent years which don’t even run Java. Personally I also believe(d) the way to go to develop truly professional, commercial quality apps is to use the language and tools most appropriate for the platform.
However, there is much, much more to this. Firstly, while you and I can spot an app that was not specifically developed in a targetted way for the particular platform using native tools, I wager that must people cannot tell the difference and, for them, it doesn’t matter a hoot. Most end users are really not that sophisticated and even if there are subtle differences in either look or feel from a true native app, why would they care if it does the job it was designed to do in a friendly, powerful or entertaining way?
For me (and obviously for you), this has not been enough and I have traditionally developed native apps for each platform. However, I have recently been looking at JavaFX (especially the not-yet-released JavaFX 8 planned for later this year) and I have to say I am impressed. As a Java developer from way back, it’s nice that it’s now just another Java API (no more reliance on JavaFX Script whatever the heck that was). It’s fully hardware accelerated, includes rich graphics capabilities, the abiltiy to embed a fully functional HTML5 WebKit-based browser component, advanced media, charting, sophisticated binding and… drum roll… Oracle have just relased an open-source prototype for deployment of said JavaFX apps to iOS and Android (in additon to all the major desktop and embedded OSes of course)!
Also, JavaFX supports full stylability of all controls with CSS and with extensions written in JNA/JNI for each platform if required for that true “native” experience, here is perhaps a true cross-platform development technology that ticks all the boxes!
It’s yet to be shown in the wild, but I believe that in the hands of a skilled developer, JavaFX apps can be written in such a way that they look and feel so native and perform so well that they are just as good as a native app with the enormous benefit of something approaching WORA (at least in a large part).
No, I don’t work for Oracle or have any affiliation with them – I just believe that this product is worth a look and may just refute a large part of what the original article claimed.
With C, you can write 90% of your app once, and then write 10% specifically for each platform. The 10% is the part the user touches, and it speaks their native language because it is native. The 90%, you can copy over to another platform and create the additional 10% for that platform.
When I started making iOS apps, I used the Web tools I already knew and a framework to run the app on iOS, but it became more and more work, and there were more and more iOS features I couldn’t get to, and framework versions to manage. Finally, I bit the bullet and started building a native app. Even though I don’t know C code, it actually turned out to be easier, because I had Interface Builder and Storyboard helping me, and whatever thing I wanted to do, I just learned how to do that thing on iOS. There are lots of books and other media to help you learn that, also. And the amount of total code that I had to write and maintain was so much smaller than with Web tools.
Basically, doing it right ends up rewarding you in unexpected ways, and doing it wrong ends up biting you on the ass in unexpected ways.