You are viewing a read-only archive of the Blogs.Harvard network. Learn more.

JavaScript is a Trap

Note: opinion

JavaScript is the most important part of web development. It’s what separates web applications from a collection of web pages.

The trap is one that I’ve fallen into multiple times and I’ve seen other developers fall into, unable to help them. They have these grandiose ideas and the way they see it working is with a mass of JavaScript. So they get this ridiculous mess of code, and they may not admit it’s a mess, but the trap with JavaScript is there is no way to write a lot of it without it becoming a mess.

One of my greatest offenses in this has been my use of extjs. This is a js framework that requires writing the code in a specialized fashion. You end up with classes that sometimes look clean but the more you stray away from exactly what the code was specialized for, the more it becomes a mess. And this happens fast.

Sometimes it’s a necessary mess. Innovation is often a mess. The problem is differentiating innovative in terms of JavaScript and otherwise innovative. Lots of people are doing innovative things, but it’s very rarely innovative in terms of the JavaScript.

So what’s the solution?

In my opinion, JavaScript in general should be minimal. 99.9% of what needs to be done for any web application can be done with jQuery, underscore, jQueryUI, and not a lot of it. I don’t believe you should ever be writing more than what you can copy paste directly from the jquery documentation. And you can replace “jquery” with any major js library. Don’t go outside of what the library was designed for, you really don’t need it most of the time. Really.

Maybe I should update this to be more about how JavaScript Frameworks are the trap, but it doesn’t matter if you’re using a framework or not, the more you write, the shittier it becomes.

1 Comment