Thursday, April 30, 2009

Leaky Web Abstractions

As a consultant and trainer, I have worked with web developers of every variety. Two things that I observe over and over again are:

1. Many web developers are so entrenched in the stacks upon stacks of frameworks needed (or not needed) to build web apps that (to their detriment) they loose track of the fundamental concepts that underlie all web apps.

2. The frameworks we use to build web apps are not good enough to allow us to learn only the abstractions provided by the framework while remaining blissfully ignorant of the web underpinnings. I believe this is called a leaky abstraction. This is not the case in more mature technologies. For example, I have been coding in Java for 10 years and not once have I needed to drop down to the byte-code level to solve a problem. I have been using Oracle for years and not once have I needed to know what goes on inside of Oracle once it receives my SQL. Nor have I ever needed to know the file format that Oracle uses behind the scenes.

But the abstractions we use to build web apps are much more leaky than Java and SQL. It's a very small set of problems that can be solved without understanding the web. True, I have seen successful apps created using slick .NET tools by people who know nothing about HTTP or client/server architecture. But just as often I see million dollar disasters that could have been prevented had the architects understood the web at a more fundamental level.

  1. As of 2009, you still need to understand the foundational technologies (HTTP, client-server, HTML, CSS, JavaScript, etc) of the web if you want to effectively architect web applications.
  2. Our Web frameworks must, by necessity, not obscure what is going on under the covers too greatly.
  3. Our Web frameworks must allow us to, on occasion, drop-down to the lower levels simply and elegantly. And then go back up to the high-level abstraction without missing a beat.
An example of number #3 is GWT. In GWT you can drop (from Java) down to the underlying JavaScript using GWT's JSNI (JavaScript Native Interface) mechanism. But unlike JNI (after which JSNI was probably named), JSNI is freakishly easy. So easy, that I now effortlessly blend Java and JavaScript in a single app all the time.

As a side note, this GWT feature has altered my perspective on the whole Static versus Dynamic language debate. If GWT can do it, I am convinced that the inventor of the NBL (Next Big Language) will able to seamlessly blend static and dynamic typing in single language.

No comments: