The Myth about Javascript ecossystem's descent into hell

joaomarcusc

João

Posted on June 5, 2019

The Myth about Javascript ecossystem's descent into hell

Warning: grumpy programmer that's been working with Javascript since Netscape 4 (1999 I guess)

I'm becoming a different kind of an old fart: the one who doesn't really miss the good ol' times when we didn't have so many any JS libraries and frameworks and everything was so simple (or so they say). I would take new JS technologies over the old, pre-NPM-projects era any day.

Yeah, I know it's sometimes frustrating to need to download zillions of dependencies so we can build a simple "Hello World" app. I can easily see the point of using Vanilla JS or jQuery even for greenfield projects. Someone who has pretty much only worked with JS libraries and frameworks such as React, Angular, Vue, etc may find jQuery or vanilla JS a breathe of fresh air. It may seem to be a great idea. After all, who needs so many external dependencies when we can just fetch data and render smaller jQuery UI components?

So, you just start rewriting that old overdone code with small JS files and simple HTML. After a couple of months/years later, you start realizing there's something not quite right about your code. You spot Javascript monsters breaking and turning the state into a spaghetti dragon firing meatballs. Then, one may think "what if we create a library that kind of lets us control page state more easily? Let's give it a name that sounds like it reacts to changes". Ring any bells?

There is a bright side to opting for vanilla JS, though. One may find, indeed, several cases where using a library is not necessary. Do you really need a "is-number-equals-to-zero" library? What about "return-false-when-object-equals-to"? Don't forget that maybe there is a reason why people choose NPM projects, etc, even guys that do web development since we didn't even have AJAX and jQuery was a pipe dream.

Vanilla JS or plain jQuery are great for really small scripts, but remember:

  • Most apps are usually seemingly small and trivial at first
  • When you project grows beyond a certain point, vanilla JS may give you headaches
  • Know as much about vanilla JS as possible, sometimes you can just use it instead of some library.
💖 💪 🙅 🚩
joaomarcusc
João

Posted on June 5, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related