Apostrophe

ES6 and Beyond: modern JavaScript is so worth it

Are the new features of JavaScript worth your time? Heck yes.

I'm an old dog. I've been coding the web since 1993. So why do I want to teach you new tricks?

In 1993 I hopped an Amtrak train from Connecticut to Seattle. Three days of the same designated vegetarian meal. Hoo boy. But the scenery was worth the food.

And on arrival I discovered two beautiful things: coffee, and Seattle's spoken word scene. Yes, I read slam poetry in dive bars. Very punk rock.

How did that turn out? Well I was, uh, popular with the critics. Audiences, not so much. Hey, I had fun.

There was one small problem: I didn't yet have a job.

Fortunately my former employer at Cold Spring Harbor Laboratory on Long Island called me up one day to ask: "hey, when you said you could rebuild our cell biology visualization software for this new World Wide Web thing... were you joking?"

I quickly decided I wasn't joking. And so I worked remotely from Seattle. Over a 14.4kbps modem. That's way slower than bad 3G for you youngins.

And so I helped take an application that was limited to a handful of researchers with access to high-end workstations (think "Unix! I know this" in Jurassic Park) and bring it to anyone with a decent PC and a modem. Slowly. Barely. But still.

That was a "new tricks" moment. And also a punk rock moment. Something that was difficult and reserved for a priesthood with the relevant skills became that much more accessible.

Enter JavaScript

Not accessible enough though. Early web applications were slow, in large part because every single interaction involved clicking and waiting, clicking and waiting, clicking and waiting for an entirely new page to be generated. A web browser was pretty much a printed book with clickable links in it.

When JavaScript was invented at Netscape in 1995 (remember them - barely?) the initial goal was modest: improve interactions with webpages, especially forms, so users wouldn't wait... for... new... pages... to... load for every tiny interaction.

Still, most interactions ended in loading a page. But skip ahead to the release of Gmail in 2004 and the web changed fundamentally: nobody had to wait for a page to load anymore. Everything you did in Gmail felt instantaneous because you only waited for the data you needed, not the entire page.

So what was missing? Well... JavaScript could now do hard things, but it didn't do them elegantly. And to be blunt, that meant it was unfriendly. The language was still full of warts: big ugly things like the scoping of the "var" keyword, or building object-oriented code with "prototype chains." Somehow, the web had regressed from making programming more democratic to bringing back the special priesthood. And command line tools like babel and webpack, amazing as they are, can feed that feeling of exclusivity. Exclusivity stinks!

Modern JavaScript: re-democratizing the web

This is where "modern JavaScript" comes in. Just when JavaScript was starting to feel like an exclusive club with too many tools, the developers of modern web browsers at Google, Apple, Mozilla (Firefox) and Microsoft finally converged on the idea that browsers should evolve quickly and get better, not lock down to ancient feature sets forever. And that means that all modern browsers can now handle new language features natively.

What that means for new developers is that they can be modern JavaScript natives. Most will never have to worry about scoping variables in a loop, or prototype chains, or (shudder, groan) nested callbacks. They will always have known modern features like const, let, for ... of, class and async/await.

Yes, Internet Explorer 11 is still out there and yes, that means learning about Webpack and Babel when you reach that stage in your project. But they no longer have to be part of the initial learning curve, and that points toward a web where programming is open to everyone.

But what does this mean for old dogs like me? It's an opportunity for us to share the "before and after" picture, and to illustrate the benefits of moving to new things when they are truly better. And it's an opportunity to bite the hand that feeds us by making things better for the next generation of users and developers. And that will always be punk rock. Some things don't change.

It is with these thoughts in mind that I spoke on "ES6 and Beyond: Modern JavaScript" at the CMS Philly conference last month. The web gets better every day! I know; I've been here to see it. Check out the video; I think you'll enjoy it. There are cats.

ES6 and Beyond - Modern JavaScript with Tom Boutell

 

Democratizing technology is also one of the driving ideas behind ApostropheCMS, and that's no coincidence. We want to make sure content creation is in the hands of everyone in an organization, not just a small club of CMS backend devotees. We believe in delivering enterprise features like approvals and localization without compromising on ease of use. And everything we're doing in the design of the forthcoming Apostrophe 3 reflects that. 

Sign up for the latest product news and updates.

Apostrophe