All this new JavaScript stuff sucks or maybe I'm getting old

danigm's picture

I'm a programmer. The language doesn't matter, it's only a tool and I can manage a lot of tools to code software. I learned to code with ANSI C and it's one of my favourite coding language. Then I knew Python and for me this is the best programming language. So if you're a javascript programmer or something like that, please, understand my point of view.

The first thing because javascript sucks is the "non include" thing. You can write your javascript code in a separated file that depends on other js file, but you don't need to write "include", "import", "require", etc. You should use the required library as if it's there and then in the html you will add the script tag in the wright order. That sucks.

As a python programmer every day I see a lot of shit arround javascript code, maybe it's not a language problem, maybe it's a programmer problem, but this shit is all around the web and new programmers, that doesn't know python, are learning to write shit over shit with javascript, and this couldn't be good.

So let's start with zen of python compared with zen of javascript:

Beautiful is better than ugly.

This one is the first and it depends on the observer, but I think that code like this is ugly

(function(){(s.opacity-=.1)

Maybe you can say that this is an example, not all the javascript code in like this... You can write code like this with python too... But think about it, look at the web and tell me that there isn't this kind of ugly javascript code in every webpage.

Explicit is better than implicit.

Monkey patching is a common javascript technique and monkey patching are doing a lot of thing implicit to your code. So Javascript and javascript coders likes implicit. That's a bad thing.

Simple is better than complex.

This one is related to previous. Maybe the problem in javascript people is that they think that what they're doing is simple but it isn't.

Complex is better than complicated.

Maybe I'm wrong, but I think that javascript is complicated, but not the language, I'm talking about all stuff around javascript, using a lot of javascript hacks to have object oriented programing or something like that.

Flat is better than nested.

Javascript is the king of the nested world, so... Lambda function as a parameter of lambda function as a parameter of object as a parameter of call...

Javascript isn't flat.

Sparse is better than dense.

This one is related to the previous one. If you look at javascript code and count ";" that separate "real" code lines you will be surprised. Maybe in a 500k javascript file you'll find one or two ";", all the stuff is done nesting.

Readability counts.

I can't read javascript super nested lambda calls, so I think that readability doesn't count at all for javascript coders.

Special cases aren't special enough to break the rules.

Javascript doesn't have rules so you don't need to break nothing. All javascript code is special case.

Errors should never pass silently.

Maybe is a browser fail, but please, tell me what part of my 500k line of javascript nested call is not working, because there's no error.

In the face of ambiguity, refuse the temptation to guess.

In the face of ambiguity, I don't know what will happens.

There should be one-- and preferably only one --obvious way to do it.

In javascript there's a lot-- and preferably one more --obvious way to do it.

If the implementation is hard to explain, it's a bad idea.

Lot's of javascript documentation, books, examples, videos, and nobody cares about the javascript shit. That only means that this is hard to explain and javascript is a bad idea.

Namespaces are one honking great idea -- let's do more of those!

Namespaces? What's that? Ok, let's use "$" before every call.

Conclusion

There's a lot of javascript weird stuff that I don't like at all. So lets stop to write javascript shit layers over other javascript shit layers before all this javascript shit party explode. I think we need to remove javascript from browsers and start to write something that doesn't sucks.

Maybe I'm too old to understand javascript and all this cool related stuff. But I think that this isn't cool at all.