Thursday, 20 August 2009

Web apps or local?

Now I have a google android based g1 phone I've been thinking a lot lately about where to focus my development efforts.
I got the g1 because it's easy to programme for and because I already use a bunch of google services so it's a natural fit. It's natural to assume that the best things to develop are native applications, akin to desktop based applications on pcs. But then google have often stated that the web is the future, not local applications, so I wonder quite what they mean by this and how it affects development.
Obviously google are biased they, above all companies, make more money from internet applications compared to local than anyone else so they would say that. I also live in the uk where wifi and broadband are improving but nowhere near world leading. I heard recently of some people in korea getting 1gb wifi for the equivalent of £10 a month. We're lucky to get 2mb for that. So why is the internet the ground on which everything should be built?
Given that there will always be a multitude of different operating systems and device types for any application to support I realised that the common ground I would expect them all to share is access to inter and intranets. So any applications that support these technologies natively would always have a significant edge.
I'm also noticing the trend towards every man and his dog having some ability to design or develop on the internet. Such that I can assume knowledge and experience of some internet technologies, such as javascript, html, css , browser compatibility, usability etc, is becoming widespread.
If that's the case, and I think it will be in a few years time, then I can see organisations and individuals preferring applications with these technologies at their core because they'll find it easier to support them.
Many also point to a world where we use the same application on different devices for different tasks at various times of the day. In effect we're moving away from using just a small set of devices with little variation. The pc is no longer the only acces to the internet as mobile phones, netbooks, tvs, games consoles are all becoming increasingly connected to the web and come with the technology to use it too. The major games consoles, wii, Xbox 360, PS3 have internet access. some TVs already have web browsers built in and many more will from next year. the iPhone has introduced a true web experience to the phone market and the free android operating system promises to bring this concept to the masses.
As a developer I see a massive challenge in developing one application that suits all these situations and interfaces. It's extremely expensive to develop similar applications to support each use. Much cheaper to build one that supports all. But how can this be done.
It's too early to go into specifics but I thought of one way I'd do it with current technology. Thought i'd log it here and see if it becomes reality.
The simple answer is I'd build 80-90% of an application in html 5, the latest html specification. This would thus support mobile and offliine solutions natively and have new features to describe video and audio etc. This provides a basic application that as many devices and uses as possible can use and understand quite happily. Quality of experience and functionality would, of course, depend on the device.
Many devices have extra functionality such as gps, accelerometers, orientation, thermometers, extra storage, built in. That's where a lot of new apps are focusing. There are also always going to be local applications that do things better than the browser for tasks such as video, audio, games, office, chat, drawing. A user might prefer the internet app to work closely with any of these applications rather than use those already provided. I would add to an internet based application the ability to read from and use data from each device when it can be made available. All i'd do is provide standards ways (api's) for the application and device to talk to each other assuming the user has given permission.
That means I still only have to write one internet app. I'd also then have to write some, hopefully more simple, applications for each device or operating system that I want to be able to interact with. All these device specific applications would do is act as intermediary between between the local tools described above and the javascript within the internet application. Enabling the internet app to talk to the device specific tools and include their data where necessary.
This model provides many things including the ability to write once for the web and reuse on multiple devices and scenarios. An an application that works without any extra device specific data but is enriched greatly when it is available. It can also get extra device data in a standardised way so you write for a device type such as accelerometer or gps at the internet app level expecting standardised data. The device specific implementations then have to provide this data in standard format.
It's a way to effectively write 80-90% of an application once, knowing that it will work on most or all devices. The final 10-20% comes from the local devices and your ability to get them to work with your application.
As a developer, and project leader, this is inviting because it defines the riskiest part of development, the code for the local devices, to be the smaller part of the work. The majority being well understood technologies and approaches tried and tested over the web.
As usual this article contains a lot of assumptions as it's just a mashup of what I've seen and learnt. The idea that javascript in the browser could access local device resources is not entirely new, think active x, flash can actually do this, and is something I understand google to be pushing for in making desktop apps as internet apps.
It does explain how the internet could be the core of applications in the future while still taking advantage of local device capabilities. It also explains how it could make things cheaper, easier and faster to develop and support multiple interfaces over time. It's probably a rehash of some document out there but I haven't seen it so thought I'd put it down in writing myself.
I just want to see how the landscape changes over the coming years and whether this model in any way pans out.
edit 20090821
Just a quick note. I noticed this great quote on an email signature. It really encapsulates the core of this post in some ways.

"Programming is the key literacy of the 21st century" - Marc Prensky
edit 20090824
Lo and behold I just found a conference session about this very issue entitled Browser engine access to mobile device APIs. I've also found another session talking about HTML 5 providing the ability to deploy web applications without a web server using a websocket. This sysnopsis also introduced me to comet. I didn't realise that Ajax had so many versions and lots of other names

edit 20090826
I just found another example of this very concept being put into practice. This time using Google Web Toolkit linked with Android location services. this whole new development has many exciting applications. No doubt it won't be long before we see applications that bring this into the mainstream.

edit 20090904
Seems like I'm not the only one to reach this conclusion. Neil Mcallister compared both android and iphone software development kits and suggested learning web technologies may be the safest option to support futre technologies. I also ran into 'web apps for smartphones' which is a nice synopsis of the area.

No comments: