Code is not code

Code is language

Code is something you can see and read but can't understand. The whole point is to hide its real meaning in plain sight. It is coded. Code, that we use in programming is not hidden. You can read it, you can understand it, you can extend it. What we refer to as code is just language.

A year into working as a programmer, I was deeply into optimization. I would spend hours on a program, optimizing it to the max even if it was to shave off a micro second. If you use JavaScript, then you know that performance is important. Interpreted code is slow by nature, but add to it the layer of the browser, the DOM, and under powered devices and it becomes even slower.

It is important to make sure the code you write in JavaScript is optimized to run as fast as possible in any given environment. And of since the browser is tied to the internet, making sure your file is small makes it download faster. As a result, I started writing smaller files. Smaller not because they were better but because, who needs those long variable names anyway?

So this code:

    var spans = document.getElementsByTagName("span"),
    titles = [];
    for(var i = 0;i<spans.length;i++){
        if (spans[i].className === "title"){
    for(var i = 0;i<titles.length;i++){
        titles[i].onclick = function(){
            window.location.href = "#"+this.getAttributes("data-id");

Becomes this (not recommended):

    var a = d.getElementsByTagName(s),t = [],i,l = a.length;
    for(i = 0;i<l;i++){
        (a[i].className === u)?t.push(a[i]):0;
    for(i = 0;i<l;i++){
        t[i].onclick = function(){d.location.href = "#"+this.getAttributes(r);};

The code is shorter but very hard to read. The bottom one is the typical definition of code: it is obscure, not everyone can read it, but the compiler goes through it like a butter.

The top one is much easier to maintain by humans. It is its own documentation without the need of comments. This is what these languages are supposed to be, languages. They are easy to understand by both humans and computers. The code we write in our programming languages are the equivalent of words in the English language. Each word has a meaning and all put together they describe instructions for the computer.

Cryptographers produce code, we write instructions.


There are no comments added yet.

Let's hear your thoughts

For my eyes only