We haven’t forgotten how to code – JS just needs to become a better language

I don’t usually write opinionated blog articles. So if don’t agree with me, please remember these are my personal opinions and I would love to hear your own opinion.

  • A quick summary of the npm chaos
  • The aftermath of opinions and the insults to us JavaScript developers
  • The problem is not with the developers, it’s the language JavaScript itself
  • JavaScript is a necessary evil that requires time to improve
  • Comment

A quick summary of the npm chaos

There has been a lot of drama the last couple of days in the npm community, triggered by Azer Koçulu who had a dispute with the company Kik Interactive over who should have access to the npm package named “Kik” – the developer who first published the package with his open source project, or the world wide company who has an 240 million user application called “Kik Messenger”.

Without any lawyers being involved, it ended with npm seized controlled and transferred over the package name to “Kik” to Kik Interactive. In retaliation of the decision, Azer unpublished all of his 273 modules from npm. Among them was package called left-pad. A package with millions of downloads per month and thousands of projects relies on, breaking every single of them and creating chaos. In order to try and save the situation, npm took control over the left-pad package and un-unpublished it.

The aftermath of opinions and the insults to us JavaScript developers

The left-pad package is actually, what is refereed to, a “micro-package” since it is only 11 rows of source code that offers only one functionality; pads the left side of a String with any given character, until a given length is reached.

However, after this incident there has been a lot of drama, blogs, opinions and statements thrown around such as if we JavaScript developers have forgotten how to code since micro-packages such as left-pad exists.

The truth is; No, we haven’t forgotten how to code. On the contrary actually, I would say that we JavaScript developers are probably more experienced with crazy, unexpected, non-consistent results which we constantly have to overcome, since our single written source code is often executed on different environments and browsers.

Our code is not compiled specifically for a deterministic platform, nor is it always executed on deterministic run-time systems as other languages are. I see us JavaScript developers as hurdle-runners where every 30 seconds we need to jump over a new obstacle.

The problem is not with the developers, it’s the language JavaScript itself

I will be very straightforward and honest here.

Micro-packages such as left-pad (but you can also include famous libraries such as Underscore, Lodash and Rambda, and even frameworks such as jQuery, and other types of polyfills) are necessary evils in a JavaScript developer’s work. We don’t like to use them, but we have to. And it’s silly that we web developers should spend time to recreating basic wheels instead of focusing on creating high level solutions.

The only reason why the package left-pad exists, is because the JavaScript language itself is fundamentally flawed and the core APIs is a mess compared to other programming languages.

So without these micro-packages other polyfills in our toolbox, our work becomes really painful.

Another example is that if you are one of those lucky web developers that still needs to support Internet Explorer 9, it means that you you are confined within the rules of EcmaScript 5. This means that if you want to figure out if String contains another String, you need to write:

if( haystack.indexOf(needle) !== -1 ) {  

Compared to:

if( haystack.includes(needle) ) {  

A core API such as String.includes (or String.contains) existed in almost all major programing languages since day 1, but not for JavaScript. That specific API literally was added 18 years after the language was first released, as part of the EcmaScript 6 specification. And this is just one of many examples of basic code APIs that doesn’t exist in JavaScript compared to other languages.

JavaScript is a necessary evil that requires time to improve

I have never met anyone who has ever said they actually like the JavasScript language and its core APIs. They might like functional programming, the idea of functions are first class citizens and its loosely typed, but never the language itself. JavaScript is actually a language that we are forced to deal whether we like it or not.

However the process of improving and progressing EcmaScript is not easy though. It is almost like, I assume, building the International Space Station. It’s a project where multiple countries needs to sign off and where each country has its own prioritization and budgets to achieve the greater goal. A process like this takes time and the chain will never be as strong as its weakest link.

So no, we haven’t forgotten how to code. The JavaScript language just needs to become a better language.

Feel free to share your comments on the Reddit post.

Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/1lQdKP2hubk/

Original article

Comments are closed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d bloggers like this: