Monday, November 21, 2011

Sometimes a Little Wrong is Totally All Right

Responding to my previous grousing over the irritations of basic web programming, reader Lee asked, "Do you think these tools/standards developed in relative isolation from each other? Or at least lacked active cross-talk among those developing them?" Interestingly enough, exactly the opposite is the case. HTML, CSS, and JavaScript evolved together, with massive feedback from people actually using them. So how did we get into a situation where people in the industry consider JavaScript broken and CSS a huge mess? I think I have a theory, which comes in two parts.

Theory Part the First: Redefining Explosive Growth
One could make a case that the Internet as a Thing with a capital 'T' has redefined our lives in fundamental ways. People call it "The Information Age," but I don't know that we really stop to think about just how young Web technology is. Tim Berners-Lee created the first HTML specification and browser in 1990. The JavaScript programming language, created by Brendan Eich in less than two weeks, first appeared in Netscape's browser in late 1995. Of the three core Web content technologies only CSS emerged out of a committee, being partially chosen from and partially created out of competing style sheet standards by the World Wide Web Consortium in the late 90s. In less than twenty-five years we have gone from particle physicists cross-referencing papers to "social media."

I'm no history expert, but I suspect that rate of technology adoption is completely unprecedented. Throughout the brief history of the Internet, people have wanted to use it for more than it was intended. Designers used to want their pages to look like magazines and newspapers, now the requirements are beyond that. We want our phone- and tablet-enabled web pages to behave like interactive movies, respond to our desires and even our voices, and do things that used to be the solely in the realm of highly-optimized, stand-alone applications.

Of course, the extreme pace comes with a consequence: the standards have a hard time evolving fast enough to keep up. Even today the big three browser back-ends, Microsoft's Internet Explorer, the Open Source Webkit engine (used in Google's Chrome and Apple's Safari among others), and Mozilla's Gecko, each support different features, often in slightly different ways. Many of these features are already in use, like the canvas demos I have been doing here. Those canvas demos do not work in IE because the canvas's HTML element and JavaScript programming interface are emerging additions to the standard. Under such conditions, it should come as no surprise that some of the t's are not quite crossed and a few i's have not been dotted.

Theory Part the Second: Which do you Prefer, Better or Working?
In addition to the technological problems associated with the explosive growth of the Web, there is a second consequence. There are, at any given time, millions if not billions of pages on the Internet using now outdated technology and tons of users using outdated browser software. This brings in the old debate over preserving backward compatibility versus breaking the old stuff to improve things going forward. Way back last century, Joel Spolsky wrote about this problem as it pertained to everyone's favorite example of a giant computer company, Microsoft. The sheer size of the Internet gives it tremendous technical inertia, making it very difficult indeed to make wholesale changes. For example, XHTML tried to improve the HTML standard, but ultimately became a useful failure that was absorbed back as an option in the broader HTML spec.

The expansion of the role of the Web is a testament to the soundness of the underlying designs, but nothing can be improved forever. Inevitably old technology accretes changes until it reaches a point of no return where it becomes more costly to modify/repair the existing system than to replace it. The trick is figuring exactly when you have hit that point. Google is hedging its bets with its Dart programming language while continuing to support improvements to JavaScript. Microsoft is betting that HTML5/CSS3/JavaScript are the way forward by using them as the UI tools for Windows 8 (in the process invoking the same dilemma with developers using their existing APIs). The W3C itself has pretty much given up, declaring HTML a "living standard" which fights to converge working implementations rather than hand down the specification to the browser vendors and web developers.

Conclusion?
Caught between rapid innovation and massive uptake, the tools that were chosen were the tools that were available. HTML, JavaScript, and CSS were there for us when we needed them, and there are too many fields being plowed to allow the workhorses back in the barn. Web programming was cursed by astounding success.

And what a success it has been. This stuff may be the most visible raw innovation ever. Anyone with a computer can open a text editor and write code to run in a browser. Thousands of people around the world have changed their lives by doing just that, and it has only just begun. The browser is a development environment that exists in literally every computer shipped today. As more and more companies converge on the Web, the standards will continue to improve and the standards will continue to be left behind. And the programmers? Well, we will continue to be faced with stupid edge cases, ugly work-arounds, odd incompatibilities, and the abiding satisfaction we get when things actually work.

Post Script
Lee also asked about resources I have used learning what little I know of web programming, so I'd like to add a bit of a link-dump here at the end.

Of course, I'm willing to attempt to answer questions as well, though if you go through all of that, you will probably know a fair bit more on the subject than I do.

No comments: