Coders are herd animals
Mattias Petter Johansson

Is JavaScript ever the best tool for the job?

I believe in using “the best tool for the job,” too. As you say, the best tool must be determined in the context of your particular problem. However, if you’re a wide-ranging developer who works in a variety of problem domains, whether it’s over the course of your career or in a multi-discipline business environment (for example, a consultancy), it’s more practical and efficient to “standardize” on a good, general-purpose tool. It’s rather impractical to master ten different programming languages for ten different problem domains. It’s desirable to “leverage” your knowledge and skills in one tool for other diverse application areas.

As a herd animal, then, I want to converge on a good, multi-purpose language worthy of my investment in time and effort, understanding that I may eventually need to move on to another tool as stagnation sets in. I need to consider a variety of factors:

  • Is the language pleasant to learn and use? After all, who wants to make life uncomfortable or painful for himself/herself?
  • Does the language have a strong and active user community? This is part of the herd mentality; there is strength in numbers. I may need to turn to the community for assistance.
  • Does the language have a strong ecosystem of libraries and tools? Nobody wants to reinvent the wheel. Libraries save time and effort making you more productive.
  • Is there good commercial support for the language? If businesses aren’t using your chosen tool, then you may suffer from lack of employment. If businesses can’t hire programming talent for your chosen tool, then their projects may be seriously hindered.

However, it’s not quite as simple as that. The last three factors would seem to support PHP as a good candidate. But many in the IT community regard PHP with disdain. It’s really a horrible language to use, its community and ecosystem notwithstanding. I suppose jobs and employment speak in favour of PHP, but doing things only for money comes at the cost of your mental and spiritual health. Just ask any COBOL programmer (I’m only kidding–am I?).

Similarly for JavaScript, a language that is widely derided for its annoyances, semantical inconsistencies, and confusion. JavaScript has a unique advantage in that it’s the native language of the web, so we can’t escape from it. Fortunately, there is a way to work around it: transpiled languages. We can have our cake and eat it, too!

By the way, I found this astonishing post not too long ago: JavaScript is not Turing-Complete!!! Marcus Neal makes a very compelling argument. Take it for what it’s worth, but it certainly does give one pause.