4 min read
Next in trending

The Prospects of CSS on the Backend

A long way coming, CSS is ready for its next move

The Prospects of CSS on the Backend

A long way coming, CSS is ready for its next move


In the early-to-mid-nineties, a new language known as JavaScript came out and took the world by storm. Web pages became dynamic, interactive, and fast, enabling surfers to do things that were once limited to science fiction.

Even though the exact date of its inception is unknown, the lasting effects of JavaScript can be seen everywhere. Tech giants like Yahoo, Google, and Pets.com started integrating the language into their own products and enabled even more widespread adoption of JavaScript.

It was only logical that JavaScript made its way to the server. The aim was to replace the arcane, gauche languages like Perl and C that were already slowly losing their grip on the backend. This war waged on for several weeks and made its way into the history books to be researched by yours truly, who was not born until much later.

Today

In 2014, we still see JavaScript dominating the backend, only gaining respect recently during its struggle with newer languages like Node.js. JavaScript followed a natural progression from client to server, and it would be criminal to think that it will never happen again.

“It would be criminal to think that it will never happen again.” — Jordan Scales

CSS on the Backend

“Business in the front. Party in the back” is one of my favorite quotes that embodies what it means to be a web developer. We see Internet technologies start off as small toolsets on the frontend that assist programmers in dealing with the DOM. With widespread adoption, however, these languages slowly creep their way all over the stack — creating one cohesive monument to man’s arrogance.

CSS is almost there.

Recent developments to CSS show signs that the language is evolving. Variables, comments, and syntactic sugar are popping up left and right as the language inadvertently preps itself for a promotion.

But there are many hurdles to overcome.

Hurdles

As I literally just mentioned, there are many hurdles to overcome before CSS undergoes the same transition as JavaScript. Here are some of the technical challenges both language designers and programmers must face in the near future.

CSS is not Turing-Complete

Since features are still being added to CSS and the newest version, CSS3, is still very much a work-in-progress, it is safe to say that CSS is not a complete language. To be a turing complete language means that anything can be constructed, but we can’t even vertically center a div yet.

I can’t tell you how many arguments I’ve gotten into with computer science professors about this, but rest assured this is, in fact, the correct spelling of “Turing.”

CSS has strange syntax

Languages need to have a clear, concise syntax in order to gain widespread adoption. CSS unfortunately looks very strange. “Rules” are written like so:

A screenshot of “Vim,” an advanced text editor

First we have an HTML tag, followed by a very strange character known as the “mustache brace.” This monstrosity can usually be found above the double quote (“) and below the minus sign (-). On Dvorak, the key is missing.

Beyond that, we see a property “background-color,” which to most says, “take the background and subtract its color.” But how do we subtract color? Is “tangerine” a string? No, it’s a constant, as well as a beautiful shade of orange.

CSS is slow

One of the more pressing issues regarding widespread adoption of CSS is its speed. Since CSS was designed on old hardware, its speed was roughly equal to JavaScript. Computers became more and more powerful, but CSS performance stayed roughly the same. In fact, CSS is so slow that many startups choose to avoid it. As proof, here’s a short benchmark I conducted.

A simple benchmarking utility that times how long it takes to execute a function

Our simple benchmarking utility times how long it takes to execute a given function. The JavaScript example I gave it (what’s commonly known as the “9's problem”) was solved almost immediately — 0 seconds.

The CSS code I tried to benchmark, on the other hand, took so long that our utility crashed. You can see CSS still has a long way to go.

Closing Notes

Similar commentary was proposed once JavaScript started making its way to the backend. My harsh critisicm is the same microscope many other technologies went under before making their way into production.

In order for CSS to truly make it as a backend language, it needs several performance and stylistic overhauls, but I feel we are almost there. I’ve already added “CSS” to my résumé, have you?


Jordan Scales is a web developer who is too scared to order pizza over the phone.