JavaScript

The JavaScript Year

JavaScript is moving too fast!

It’s been said a million times in a million blogs. By this point, I’m using a dead horse to beat a second dead horse. But hear me out.

Let’s imagine you were given given a moderately-sized web project created by a junior dev. The project has been around for two years and hasn’t been updated since its first release. You want to bring things up-to-date in case someone has to pick it up down the line (because they probably will!). And for fun, let’s say you’re crabby and critical today. What do you see?

The backend

.NET project? You’re probably ASP.NET MVC 5.1 or 5.2. Looks familiar! A couple things might be missing from a project created today, but we are not hindered whatsoever. The code may not be great, but we can get by. Wait, why is all the Entity Framework code in the controller? Ugh. Oh well. We can fix this. This is practically the same framework framework as what we’d use today, after all. Digging deeper, it looks like we’re using SQL Server 2014, IIS, and running on Windows Server 2012. Nice and familiar. Time to get to work!

What about Django? Probably on 1.4, running on Python 2.7. So, we’re a little behind, but that’s alright. For the most part, we can get up and running after a bit of work. Let’s follow the release guides to get us to 1.8… that should be fun… We can upgrade to Python 3, but Python 2.7 won’t kill us, right? Still on Apache 2.4 too. Ah crap, no one patched Heartbleed!!

Rails? Hey, still on Rails 4. Not too much has changed. Some of these gems are way out of date. Ugh. Gotta clean those up. This code kinda sucks, but at least there’s not too much of it to complicate things. Thanks, Ruby.

The frontend

Overall, things aren’t TERRIBLY far off from what we have today on the backend. Let’s take a look at the front end JS.

Scenerio 1: KnockoutJS?! Oh God, NO! I’m out of here.

Scenario 2: AngularJS? Oh, cool. Wait. Why is this controller on the window? Why is nothing dependency injected?! WHY IS ALL MY DATA ON THE WINDOW?! Everything is on the scope… there’s no controllerAs… no components… Upping this to 1.5 is going to suck.

Scenario 3: React? Well… I don’t know what React was like back then, but I will blindly assume you’re upset at how drastically different things are.

Overall thoughts? Why are we on ES5? Obviously we should be transpiling ES6 or TypeScript. Where’s our gulpfile? What do you mean there isn’t a gulpfile? Wasn’t everyone using gulp? What about the LESS or SASS source? WHAT? CSS? Why is ever Bootstrap 3.0 rule being overridden by a 10-item selector? Underscore and not lodash? Can I go home?

No, you can’t go home.

You have to deal with this. Just like someone who picks up your project in two years will have to deal with your shiny new toys and hate your guts for picking Angular 1.5 instead of Angular 2 (or 3 or 5 or whatever it is in two years). Just like someone will complain that your ES6 or TypeScript code isn’t instead being compiled by UnScript (that still makes me laugh).

This is kind of what it feels like picking up a project from 5 years ago on the server side. “MVC3? Seriously?” “Oh God, Django 1.2?!” A lot of times it feels like there’s no way out of those. You have to start from scratch or let the project slowly rust into further obscurity and disuse. Don’t get me wrong, we’re probably also using jQuery and will want to re-write that too.

But look at the progression of the front-end. Technology-wise, we are DRASTICALLY different from where we were merely two years ago. As a community, we’ve learned a lot too. Better practices are being established for frameworks. Things are moving forward very, very quickly – and for the better. On the serverside? We are pretty well-established, for the most part. We have a lot of strong design patterns in some proven, battle-tested frameworks. In JavaScript? Not at all. Not client side or server side. And that’s okay. We are learning and progressing – as individuals and as a community.

My point is, choices made in JavaScript don’t stay strong for nearly as long as they do in .NET, Java, Python. The half-life is much shorter. One year in the JavaScript world is like 3 years in the rest of the world.

So, what is a JavaScript year?

1 JavaScript year == 4 Gregorian calendar months.

Ahh, crap, I meant to use ===. Where’s my linter?

Leave a Reply

Your email address will not be published. Required fields are marked *