Uncategorized

20 Things About Web Apps

I love it when people explain complex topics in simple terms. Not because I'm a simpleton but because it makes the knowledge more accessible to the wider audience who really ought to know more about this stuff.


With the "Rich vs Reach" debate still raging between desktop and web developers (and firms with a vested interest in either. i.e. Microsoft and Google), the Google Chrome team put together this nice little booklet to convey information about web-delivered applications. Sure, they have a very strong preference for web apps but it is a fairly impartial summary.

Put simply web apps are moving forward in leaps and bounds because of many great innovations:

  • Developer tools like GWT (Java to JS) and WebSharper (F# to JS) are being created to allow developers to generate pesky JavaScript code from other higher-level languages, to accommodate folks who aren't JavaScript fans. This enables much easier development of web apps for those who are from a desktop development background;
  • Modern browsers, like Chrome (V8), FireFox and IE9 (Chakra), have much smarter JavaScript engines that compile rather than interpret JavaScript. This makes JavaScript code run a heck of a lot faster than it use to;
  • The slowest parts of web page rendering: image downloads and DNS resolution, are being addressed by new image compression techniques, like WebP, and browser features like DNS pre-fetching;
  • The new HTML5 standard includes many new features like the canvas tag, the video tag, and web sockets that make for a much richer in-browser user experience; and
  • New techniques help minimize the latency associated with server round-trips that typified web apps for many years. Currently, developers resort to Ajax and Comet techniques to hide or minimize the latency but Comet is hard to get right across all browsers. The HTML 5 WebSocket represents a standardized way to address the problem that has been targeted by Comet and Ajax in that it defines a single-socket full-duplex/bi-directional connection for pushing/pulling information between the browser and server. Thus, it avoids the connection and portability issues of Comet and provides a more efficient solution than Ajax polling.

The next 5 years is going to see some really cool web applications that are installation-free, have "desktop-like" user experience, and are backed by on-demand super computers. i.e the cloud. I can't wait to see where it goes from here!

Uncategorized

Google I/O 2009


A few weeks back I posted about the JAOO conference giving it a strong thumbs up. Well, it's been less than a month and I've managed to find an event that tops even JAOO. It's the annual Google I/O conference which is Google's developer conference. I've not previously attended one but this year it was held in San Francisco and, despite the risk of swine flu, I gladly made the trek across the Pacific. And boy am I glad I did! The opening keynote on Day 1 was chugging along nicely with Vic Gundotra lauding the capabilities of the new HTML 5 standard with some interesting demos, and then there was the 'Oprah moment'....

"In this little box, you'll find a brand new Android phone with a paid-up AT&T SIM card (data-only) valid for 30 days, and I have one for you, you, and you, and you...Everyone, all 4000 of you will get one!"

Thanks Google. That's, what, a $600 phone? Not bad for a conference that costs less than that to attend. It was in fact a free HTC G2 phone which has impressive specs (accelerometer, touch screen, 3 Megapixel camera, slim form factor, long battery life, etc) but more importantly it runs the latest Android operating system. Within minutes I was connected to my gmail, calendar and a was surfing the web in landscape mode scrolling web pages up and down with my pinky realising how much better the mobile web experience is on a decent phone (and free data access). Don't want to type in that 7 or so character bit.ly url? Point your cameraphone at the QR code on the billboard and an application on the phone scans it, does the image recognition and pops the web browser AT THE URL you just took a picture of.

I'm really excited about the Android vs iPhone shake out. On one hand you have the open platform backed by "the open alliance" and on the other you have the closed-network, controlled walled-garden that is the Apple iPhone ecosystem. Haven't we seen this open-versus-closed ecosystem stouch before?

The keynote on the second day was no less enthralling. Google gave a sneak preview of an awesome new product they are building in the Sydney office - Google Wave. This product was the brainchild of the Rasmussen brothers, the technical geniuses behind the Google Maps product and the reason why Google opened an office in Sydney. Put simply, they have re-invented the communication mechanisms that are prevalent today (email, instant messaging, collaborative document editing) and produced a remarkable product that has a number of innovative features like concurrent, real-time editing, and change playback ability. It has the snappiness of a desktop application but it's a pure HTML5 web app so it comes without the painful deployment/update scenario that desktop apps are laden with. I truly hope more corporations look at it as an alternative to the extremely painful SharePoint product that has become prevalent. In corporations today a development team will share information via numerous mechanisms leaving vital shreds of information in email, IM, Office documents sitting on file servers, in-house wikis, the comments in the version control system, status notes in the task management system for the benefit of the team leader, and in a corporate SharePoint site because we don't have enough data islands already?!?! Enough already. We don't need more tools like SharePoint, we need one tool that replaces them all. That's a huge ask - displacing established mechanisms and hoping people change their habits - but that's why Google is Google. Hyper-ambitious and the "smarts" to have a decent crack at making it happen, and eventually be monetized.

I've been inspired by this product. There's a lot in the technical details that aren't initially appreciated. When you start to dive deeper you'll see the tremendous focus Google places on the user. Many corporations would cite the Pareto principle and not go the extra mile. Maybe because they can't? Or maybe because they believe products only have to be "good enough".

Well done, Lars, Stephanie and the Sydney googlers working on Wave.

Of course, in between 2 knock-out keynotes were also a huge number of very useful technical talks. Android, GWT and AppsEngine were heavily promoted, from an engineering point of view, whilst Wave also had a number of follow-up talks. The more I see of GWT, the more I like it. Anything that makes AJAX development faster and easier has my vote.

Definitely worth going. I'll be back for more some time soon.

Uncategorized

Inside Chrome’s V8 JavaScript Engine

Recently I've been digging through the C++ source code for the V8 JavaScript engine inside Google Chrome - in my mind, the best browser on the block by a long shot! Reviewing the internals has been a good refresher on efficient C++ programming though it is hard to adjust back to K-R indenting after using Allman indenting for so long with C# (I wonder how Pythonistas react to all those curly braces when jumping back to C/C++?). The design is very clean and the use of hidden classes for fast property access, and compilation to machine code (yes, MACHINE code) are just some of the secrets to its' speed. Of course with all these hidden classes floating around it was imperative they created an efficient Garbage Collector. I haven't yet been through the GC code so I won't elaborate however, according to Google, V8 uses a "stop-the-world, generational, accurate garbage collector". Looking forward to that! It should be interesting to contrast this approach to the fairly innovative concurrent GC architecture recently unveiled by several Microsoft researchers working on Haskell.

Here's the V8 Tech Lead, Lars Bak from Google, giving a very quick (5 mins) overview of the salient features of V8. He's Danish so trust me - it is English he's speaking:



If you suffer from the same "How does it Work" curiosity as I do you just point your favourite SVN client at:

svn checkout http://v8.googlecode.com/svn/trunk/

and you can read, and contribute to the code. The in-line comments are fairly minimal because the code is fairly self-documenting, but I did notice that the programming gurus at Google have been reading the same books I have. i.e Hackers Delight. The code extract below is from utils.cc. Which reminds me - I must write up a summary of the bitwise operations that come in handy more often than you think, but that's a topic for another post!


// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
// figure 3-3, page 48, where the function is called clp2.
uint32_t RoundUpToPowerOf2(uint32_t x) {
  x = x - 1;
  x = x | (x >> 1);
  x = x | (x >> 2);
  x = x | (x >> 4);
  x = x | (x >> 8);
  x = x | (x >> 16);
  return x + 1;
}