CSS 3 Grid – just like layout tables, but more annoying

While I do respect the idea behind separating content markup (HTML) from visual styling rules (CSS), it sucks in actual practice.

Consider the CSS 3 Grid.

This would be much easier if we just had gone with an HTML <layout> or <grid> tag back in 1995, then developed media/device specific sub-dialects of HTML instead of going down the CSS route. Back then, supporting a grid or layout element would have been as simple as copying/pasting table rendering code; and there were a lot of proposals to add exactly that kind of element back then.

Instead though, committees were formed and CSS was inflicted. The CSS proponents, and those that came to the web afterwards and don’t know any different, all have a lot of praise for CSS and the neat things it lets us do.

But to me, real result of going with CSS instead of sanity is that, 15 years later, we’re still only in the proposal stage for an officially sanctioned grid-style layout mechanism.   

Amazing Little Things

One thing I love about programming is that, even after 15 years, I still come across little things that amaze me.

This JavaScript (derived from an answer on stack overflow) toggles the value used by an HTML checkbox.

isChecked ^= 1;

This trivial logic combined with JavaScript’s peculiar type conversion mechanics results in one of the most elegant expressions of intent I’ve ever seen in a single line of code.

node.js: Revolution or Just a Repeat of 15 Years of Failure?

Server-side JavaScript (SSJS), we are being told, again, will deliver the web’s new and brighter future; a future that, apparently, looks just like the parts of Microsoft’s 1996 that no one cared about.

In 1996 Microsoft had comprehensive support for JavaScript on the server. You had Active Server Pages for the web, and Windows Scripting Host for systems automation. Both technologies had  built-in support for JavaScript as a first-class language. 

No one gave a shit.

In 2001 Microsoft released JScript.NET, a version of JavaScript on steroids. It was highly optimized for server-side development, and was promoted as a first class language along-side C# and VB.NET; it was especially promoted for ASP.NET web applications. 

No one gave a shit then either. 

Microsoft still ships classic ASP and the WSH, and both still support JavaScript. They also have continued to release new versions of JScript.NET, though these days they just call it JScript 10.0.

It isn’t as if Microsoft was the only one to do viable SSJS implementations over the years either, and universally they have all failed to generate prolonged interest. JavaScript has come a long way over the years, but there hasn’t been a significant change in the language to makes it suddenly more appropriate for server-side scenarios. The best that can be said is that JavaScript doesn’t suck as bad as it used to.

But now, after 15 years of apathy towards server-side javascript, suddenly people can’t seem to stop talking about it! Projects like node.js, Helma, and Jaxer (just to name three) are getting a lot of press. I’ve even heard 2011 called “the year of server-side JavaScript” by some. Node.js seems to be getting the lion’s share of the attention, and there is even a .NET clone of it called node.net (WTF!?!?! Really?) 

The irony is almost maddening! 

Also, don’t buy this nonsense about re-using the same skills on both the client and the server. That was exactly the same marketing used for JavaScript on old ASP back in 1996.

JavaScript was my first language, and I was one of those few who wrote classic ASP in it. My excuse was that I’d be reusing my existing investment in JavaScript. Take it from me… the skill-reuse argument is pure bullshit.

The actual “skill” in JavaScript is in learning the (horrible) HTML object model and client libraries. None of that translates to the server, so all you keep is the C style language syntax. So, why not just use actual C, or one of the dozens of popular, and more server-appropriate, languages with a C derived syntax?  

Despite all the history though, it’s clear that node.js in particular has gained some impressive traction. There are a ton of rapidly evolving modules for it along with a growing and enthusiastic developer community.  

So, maybe Server-Side JavaScript’s time has finally arrived this time. I personally hope it’s just a fad though. I’d much rather see all this effort get put into bringing real programming languages to the browser (like Google’s Native Client does).