The New Dynamic Website - Part 2
In the immortal words of Bill Cosby, "I told you that story to tell you this one."
It took me a bit of thinking before I realized this is not just some passing development fad, but an actual shift in how the web itself worked.
If you think about it, the power of the average web browser is greater than it ever has been before. Not only because of Moore's Law, but because of huge improvements in speed, quality and functionality over the past few years, pushed mostly by Google and Apple. This in turn has spurred Microsoft and Mozilla to finally get off their asses and create competing products as well. Combined with the movement towards HTML5's new capabilities, we are all using a browser today that is far, far more powerful just a few years ago. (With so much recent focus on cloud services, I think this has been overlooked, or at least it was by me.)
More powerful browsers mean we can rely on them to do more work, rather than doing it all on the server - specifically we can start to push the line between where the Content or User Interface starts waaaay over to the client side, letting the server be dedicated to back-end logic and data management. This has been tried before lots of times, but this time, I think, is different.
I was trying to pinpoint why I think this, and realized in my case, there was more to it than just HTML5 support. In addition to the beefed up browser and new buzzwordy spec, there's a few other important parts in the equation as well: Developer tools, JSON data, non-PC browsers and Apps.
Huh? Let me explain...
Developer Tools are the new View Source. It's pretty accepted wisdom that a big part of the web's adoption early on was due to the fact that anyone could 'view source' on the page they were looking at to see how it was created. View Source is almost a religion in many ways, and there's not a PC browser that exists today that still doesn't have it prominently displayed in their menus somewhere. But what happens when you view source and the entire page has been dynamically generated? Well, you get nothing but a mostly empty HTML page, a few script tags and a div tag or two. But Developer Tools like Firebug, Chrome's "Inspect Element" and the equivalents in IE and Safari, re-enable this fundamental feature of the web, allowing you to view the DOM and the scripts of the page, even if it was created dynamically in the browser. This lets other developers learn from these sorts of pages, and then go off to develop their own. It's a cycle I think was broken for a time, but now is back and is just as important now as it was during the first era of the web.
Browsers are now everywhere, and they all work pretty great. The newest buzzword is the Responsive Web, and though I bristle at it every time I hear it (do these guys think they invented "mobile first"?!?), I think it's generally a great idea. A web page should as flexible as possible, being able to work just as well on an iPhone, an iPad, a regular PC or even a wall-sized display. In order to do that, you need to have as much intelligence on the device as possible. Doing device detection on the server with User-Agent databases just doesn't work (I know from personal experience): Devices lie, databases go out of date, etc. If developers really want to create responsive interfaces which adjust dynamically, the device itself is the only place to learn about its capabilities. That means moving more UI to the client.
All of this, in my opinion, adds up to a new way to look at web app development. It's a browser-first focus, where the server is simply there to serve up data as needed. Again, that's not a new concept, but this time it's really going to happen. Now that I've actually tried it a couple times - having a web server that does little more than serve up static files and JSON data to be formatted dynamically on my phone, tablet and PC - I see how fast, flexible and functional this approach is. It's hard to go back (well, except when I'm being lazy).
Still, I'm convinced it's inevitable - 20 years of shoving data into HTML templates is coming to an end, I can feel it. Long live the new dynamic web!