This is in reply to this post on medium that was recently shared by Sidebar on one of their recent daily newsletters. I found this post so ridiculous that I felt compelled to write this follow up post.
It doesnt matter how many languages you used. What matters is wether you used them right and wether the end product was what you wanted it to be. It matters how efficient that end product was and how usable it is. It matters if the code written was maintainable and readable. It doesnt matter how many languages you used, it only matters how efficiently those languages were used.
Freeing hand space is critical, so it’s important that we try to remove one of the languages in our stack. HTML can only be replaced by XML, which defeats the purpose of saving space, and web pages on modern browsers cannot run without Node or PHP. Through process of elimination, we are left with finding an alternative for CSS. Fortunately, that is possible with Node.
Hold on, wait, is the author actually saying there is no other language out there that can serve up web pages other than node and PHP? and why is is so critical to remove a language in the stack? Also, if it is so critical, why not remove PHP or Node and handle the logic in one of those (very small subset of languages available)?
Using Node Instead of CSS
Replacing CSS with Node is easy and actually a lot more intuitive and whitespace-free. All you have to do is open your .js file and type in the instructions for changing the style of elements. For example, take a look at the following CSS for changing the color and padding of a paragraph with id “gulp”:
color : #0000ff;
padding : 10px;
This CSS takes up 4 lines, and at least 13 spaces. In node, we’ll change the style for the same paragraph:
This Node code takes up only 2 lines and there are 0 spaces. Essentially, we are saving lines, spaces, and files (delete your .css documents!).
2. If 2 lines are better than 4, the css can be written in one line
now, by the same argument, css became a better choice.
3. The JS written is ineffecient. The author is traversing the DOM twice to target the same element. A better way to write that would have been to cache the element in a variable and do the style updates on the variable.
var gulp = document.getElementById(‘gulp’);
Either the author chose to not do this out of ignorance or to make a point. I dont see the point. The problem with this style is that it is not maintainable. CSS is much more DRYer than this proposed JS method. It easier to maintain and on top of it, it has all the hardware accelerated goodness that comes with natively supported languages.
The Future of CSS
Just like the blink and marquee tags, it will only be a matter of time until browsers stop supporting CSS, so the sooner you start using HTML5 to style your pages, the longer your projects will last in the future.
It’s time to take back our fingers and whitespace and stop using so many languages to perform the same tasks.
This is when I kind of realize that this whole post is satire (at least I hope it is, for the love of all things web!). I should probably just give up on all languages and write my web pages in assembly (makes things way faster, no?).
In conclusion, those of you who are new to web development and took this article seriously, UNLEARN any coding patterns you might have learnt through this post. I believe it is meant to be satire. For those who saw it coming from the beginning, touche.