Java VS JavaScript – It's a question of good taste and why elegance matters.

Java VS JavaScript – It's a question of good taste and why elegance matters.

Java VS JavaScript James Gosling Brendan Eich

Comments

I hear people say don't get emotional about a programming language, it's simply a tool to achieve an end result – I'm here to call bullshit on that!

I have been a programmer for over 20 years and for at least 15 years I've programmed C# on the Microsoft .NET platform. During the time there was a voice saying there has to be a simpler way, this is needlessly over complicated! But then I guessed that some very cleaver people have designed this language and the .NET environment so they must have it all figured out. The thing is C# and .NET is largely a rip off of Java and the Java JRE.

People often say that C# is 'Java done right' and I guess it is but if you do a better version of an abomination, it's still an abomination. Now I find C# a bit verbose and boilerplatey but that is nothing compared to Java, when I read through any Java I just want to cry. A good parody on the ridiculousness of Java can be found here.

So I was starting a new project and without any forethought I got up and running with my old tools, opened up Visual Studio and starting banging out some good ole C#. The project was not particularly complicated but half way through I was already suffocating under a mountain of boilerplate code and workarounds. The voice was now shouting loud at me 'There has to be a simpler way!'. I had been looking into Node and have programmed some JavaScript over the years. Now you can code JavaScript without getting it. At this point I hadn't 'got JavaScript'. I listened to the voice this time and decided to learn JavaScript and Node properly, recode the entire project and deploy on Linux for the server side stuff. So in one fell swoop I waved goodbye to Microsoft, C# .Net and hello JavaScript, Node and Linux. This was the best move i've ever made and have not looked back since.

Once you get it, the simple elegance, beauty and power of JavaScript is intoxicating. Here is an interesting talk by David Crockford about JavaScript.

It has been argued this is a debate over statically VS dynamically typed and this is true to a certain extent but I contest this is also a debate about taste, Java is just plain old bad taste, taste matters! Now I have firmly moved over to the dynamically typed camp, the freedom it gives you and the reduction in boilerplate code is worth sacrificing the PERCEIVED safety that a statically typed languages give you.

Using a dynamically typed language, as long as you validate all inputs to a program then you are largely free to enjoy the expressiveness and freedom that mutating objects at runtime gives you without any of the downsides.

Here is a video of Steve Jobs talking about taste:

Brendan Eich

Brendan Eich, a personal hero of mine, created JavaScript in 10 days whilst at Netscape. It was this extreme time constraint along with Eich's good taste that led to a lot of unnecessary things being left out. By having functions as first class citizens, the need for classes where totally negated. Classes are evil! And don't get me started about namespaces!

James Gosling

James Gosling the creator of Java is in my opinion a man without good taste. It may not be all his fault as it was developed by committee but he had a large part in the abomination. He has admitted himself that it was developed in part to make sub standard programmers useful and productive.

The bad taste that comes with Java is starting to infect the JavaScript world with atrocities such as the angular JS framework. Please check this article for more on angular.

Fortunately you can avoid it like the plague and leverage the many awesome elegant JavaScript libraries out there. 

Lots of things coming out of Mozilla have very good taste, take the excellent Rust systems programming for example. 

So in summary, developers with good taste are the 10x developers. Good design decisions and using the right language can massively reduce the LOC (Lines of code) required for your project. This is important as it's a fact that bugs occur every x lines of code largely irrespective of language.

Here is a talk by one of my programming hero's about writing good software:

Article Written By Zoftar : January 9th, 2018.