Back to Home

JavaScript as a phenomenon

Javascript

JavaScript as a phenomenon



The nodejs community is crazy, and judging by the fact that in 2016-2017, in various ratings, JavaScript took the first place in popularity by crowding out Java by a small margin - the madness has really become widespread lately. It would seem - if you don’t want to eat, write in your favorite Elixir / Erlang / Lisp / Haskell / any other language with a good design and do not blow it, but in the current situation, unfortunately, this rule stops working and you have to make some efforts to comply with it .

What is the reason for the popularity of such a really bad language like JavaScript? In principle, the same is the reason for the popularity of Java, and indeed almost all the phenomena of culture and society - in the dough. When giants such as Facebook, Google, Microsoft and Twitter systematically pour multimillion-dollar streams of bloody dollars into JavaScript infrastructure, write frameworks, libraries, come up with standards and architectures, it becomes really hard to ignore it. Such a strong infusion of dough causes a frantic hype drive-development. The employer wants to see React, Redux, Relay, Realm, Flux, Babel, Webpack / Grunt / Brunch, and a dozen more buzzwords from our favorite corporations that I don’t even know. And all this is seasoned on top with a bunch of plug-ins for the same technologies, all varieties and colors from our beloved npm.

At some point, the huge demand for development in a really terrible language spawned a huge multitude of sometimes rather strange compilersin JavaScript from other, more acceptable languages. It is quite logical that developers tormented by the strongest cognitive dissonance (I want money, but I do not want JS) somehow tried (and try) to reduce the pain of developing in JavaScript. Personally, I tried quite a few languages ​​from this list, for some time I wrote similar languages ​​in CoffeeScript, the most successful LiveScript example is from a currying box, pipes, the absence of stupid brackets, semicolons, loops and return s. I even tried PureScript - an example of compiling Haskell code (with immunity, monads and a wonderful system of strong types) in JavaScript. In fact, of course, all these languages ​​are not commercially demanded for obvious reasons - there are no millions of injections from corporations in the development of infrastructure. If there were any, I give a tooth,

It would seem that, as a backend developer, this should not bother me at all - let it be npm obscurantism on the front end, I have a little order here, a kosher tube OTP just like in 1986. But it was too early to relax - they pulled out the JS engine from the browser and dragged this substance to backend, with an absolutely serious expression on his face. After all, it’s one thing to write some SPA in this language, and absolutely critical billing is another thing. But JavaScript is now on the backend, great.

  • single-threaded runtime (in 2017 !!!)
  • lack of a unified system / standards for the implementation of modules (again, 2017 in the yard)
  • lack of uniform standards for the project structure (everyone does as they want; source codes can be very difficult to figure out)
  • weak types with implicit (and sometimes rather strange) conversions
  • lack of normal classes / OOP
  • lack of a single sane and working static code analyzer (welcome to the wonderful world of stupid errors like undefined is not a function )
  • lack of type inference in the language itself or in any tool
  • this wonderful this context (what does this mean at this point in the code - an object? function?)
  • absolutely stupid implementation of pattern matching (you match an empty list / object - no problem, you get undefined from there, you mean exactly that, right?) and here again hi cannot read property foo of undefined
  • lack of a unified technology for working with asynchronous code - callbacks, prims, futures, async (if the project has more than one dependency from npm then it is guaranteed that all of them will appear mixed in the code)
  • const (which is NOT const)
  • absolutely insane npm with “brother I brought you something to eat” quality packages (and even with this one )

And I’m also silent about the subjective look at features that annoy me personally, such as mutability, curly braces, semicolons, return, lack of uniform standards for working with data structures, lack of macros or any custom infix operators / functors.

In general, JavaScript is terrible no matter how you say it, but it is wildly popular due to the dough and the low entry threshold. When in front of your nose they drive a bundle of green bills - it's hard to resist, but I hold on. Mental health is more expensive. By the way, I recently read about the activity of Facebook in the field of the Ocaml language - so it’s possible there is light at the end of the tunnel, but this is not accurate.

Read Next