Why I hate Javascript and love working with Javascript

Javascript is such a crippled language. If you want to write a good Javascript application you have to accept and understand some of the inner workings and plain weirdness going on. Every time I touch Javascript I remember that the initial version of the language was created in a few weeks time. Aeons later it still looks like something that was created in a few weeks time.

I’ve worked in situations where Javascript is encountered for about 10 years. While working in ASP.NET or ASP.NET MVC applications Javascript is often used to glue the views together and make the application polished and useful. For me, the language itself was never the biggest problem. The frameworks and libraries were. Or, perhaps it wasn’t the libraries and frameworks. Perhaps the main problem was that everything was about DOM manipulation, weeks of compatibility coding for Internet explorer, and the mixture of ASP, HTML and Javascript you inevitably ended up with. Even when everything worked the way you wanted it to - you felt a bit dirty and it all felt like a bit of a hack that would fall apart as soon as you looked away.

Libraries like JQuery and Knockout became the bad guys in my eyes as they presented solutions to problems I didn’t want to solve. When the problem is flawed from the beginning, it really doesn’t matter what kind of solution you end up with. I don’t blame the creators of the libraries, but I still don’t like them and I still don’t want to use them. JQuery has, however, in some way, been an important part of the groundworks for the Javascript revolution we’re currently experiencing.

So, from my point of view, Javascript is a sloppy language that lets you create the worst code you can possibly imagine to solve a problem we shouldn’t be solving in 2015.

…but I really love to work with Javascript…

I do. Really. Every time I get to code something on my own spare time, I always go with Javascript. It’s obviously not because I like the language — but because I like the atmosphere. The language is such a small part of working with Javascript. It’s more like building Lego and combining the parts of libraries that you like to solve your problem. The code you write is mostly about filling the void between libraries (and the unique stuff that you want to do, but honestly, in my spare time — there’s not a lot of unique stuff going on).

But what about professionally? If I look at how teams with .Net or Java developers work, it’s not uncommon to hear people talk about finished products as the end goal. To me, a finished product is a dead product. As soon as a product has zero attention from developers — it’s dead. Yet, this is how many companies reason when they talk about products. In the Javascript world, there are far more acceptance for the concept of a living product, and that a product doesn’t get finished (unless it dies).

Why is that? I think Javascript developers constantly are looking for the next big thing, and the Javascript community keeps evolving at a hysterical rate with new frameworks, libraries, principles and patterns all the time. Just look at the impact from AngularJS or ReactJS. Both of them redefined how a modern web application was built. Javascript developers know this, and the good ones build code that easily can be replaced when the next big thing gets here (no, I’m not talking about the next iPhone).

Great developers build code that easily can be removed or replaced. This is what the industry is currently moving towards. Look at Microservices for example. It’s a “new” way of building systems in smaller parts that easily can be replaced. In C# or Java we’ve spent 10 years talking about how to reuse code in the best possible way, when we should have talked about how to write code that can be removed in the best possible way. Great Javascript developers get this, and there is a much greater will of changing things in Javascript than in C#.

The other thing that I really love with working with Javascript is the tooling. There are so many tools that will help you when you work with Javascript. Visual Studio is great for working with C# and IntelliJ is great for Java. But far too many developers use these IDEs and don’t explore their options. There are lots and lots of extensions and tools available for these tools, but a lot of them costs money and some don’t work together. The biggest problem is however that developers don’t care. Many C# or Java developers take very little interest in their development environment. Great Javascript developers are restless and keep looking for new tools that will help you to write better code on an everyday basis. The community around nodeJS and NPM is incredible and there are new things available for free every day. And everything is available at your fingertips by a simple command. You hardly ever need to care about installers, typing your VISA number or licenses for node packages — just go with the flow.

When I took my first full time job, C# was kind of the new kid on the block. The language and tooling allowed you to work faster in comparison to C++. This was 10 years ago. During these 10 years, C# has slowly evolved into a solid language with a growing community.

During these 10 years, Javascript has gone from hiding links and creating captchas into being the #1 way you create a good web application. It has grown from a few lines at the bottom of a HTML file into defining the entire client experience. It now runs on the server (nodejs) and on mobile devices (react native).