Life as a developer

ES 2015 – Worth the wait?

Part I

This is a summary of a presentation that I held for the Trondheim Developer Conference(TDC) 2015. Check out my presentation on Vimeo, but I have to warn you, it is in Norwegian.

It is split up in two parts
Part I – Short history and overview
Part II – Examples

JavaScript – a short history

In 1995, Brendan Eich, a developer working for Netscape, started a project to create a script language for the browser. After two weeks, the first version of the language we now know as JavaScript was done. Two years later, Netscape went to ECMA, an independent organization, to create a specification. The result was ECMAScript. In short, ECMAScript can be looked at as the interface or contract, while JavaScript (and other languages like Nashorn or JScript) are an implementation of that interface. Now it is a committee (Technical Committee 39) that are responsible to guide the development of the language.

ES 2015 went under the name ES 6 for a while, but they have moved away from an incremental versioning and over to naming based on the year of release. That implies a yearly cadence of major releases, which is a great improvement over previous release cadence. One of the benefits of a shorter cadence is a shorter feature list for browser vendors to implement.

Versions

EcmaScript timeline

ES 1 First version was released in 1997.

ES 2 The next version came out already the year after, but only with some minor improvements.

ES 3 Most developers that have been working with JavaScript for some years, are familiar with version 3, which came out in 1999. It introduced regular expressions and try-catch among other things.

ES 5 This is where things start to get a bit “tricky”. There were several parties that were invested in JavaScript, each with their opinions and wishes. So two groupings emerged. One with Mozilla and Brendan Eich. They worked towards bringing in a bunch of new features in version ES 4. Another group with Microsoft and Douglas Crokford, believed it was better to implement a minor update in fear of breaking the web. After a meeting in Oslo, the decision was made to go for ES 3.1 (the minor version) which then finally became ES 5.

ES 2015 Now we get the biggest update ever. We can see a lot of features planned for ES 4, now appearing in ES 2015.

Some of the priorities for ES 2015 are performance and scalability. They are also making the language better suited for future improvements. All this while still maintaining backward compability.

Polyfills

While the new features are mostly implemented in the language, browsers are lagging behind. So before you go a head and make the switch to ES 2015, you need to make sure that the new features you want to implement are supported by the browsers that your users use. You can check out CanIUse to see if a specific feature is implemented or check out Compability table for charts grouped by browser. There are still a few features missing, but fear not, there are ways for you to start already today. You should always use a Polyfill and with ES 2015, Core.js is a the best option. It let’s you write ES 2015 code, and tries to fill in the missing features. But unfortunately not all features are covered. To fill the remaining gaps, you should use a transpiler that can take your ES 2015 code and turn it into ES 5 code that are supported by the browsers. A transpiler is quite similar to a compiler, the only difference is that while a compiler compiles down to another level of abstraction, a transpiler converts your code into to another language at the same level of abstraction.

I recommend that you pre-transpile before going to production (for performance). This can be done as a part of a gulp or grunt task.

Another transpiler is TypeScript, which in addition to ES 2015 features provides type definitions. It can transpile down to ES5 or even ES3 if desired.

Continue to the examples …

goldnarms

Arnstein Johansen is a .NET Developer with a speciality in web development, but he also dabbles in mobile development and everything new and exciting. Arnstein works for Itema AS, a mid-size consultant agency in Trondheim. Itema has 25 consultants and recently won the prize for Norway's best workplace. He likes to share his knowledge by holding talks for others, either it is clients, colleagues or likeminded developers in user groups. He has hands-on experience from large projects, the latest from Urørt where he leads a team of developers creating a music service used by around 100000 users.

One Comment

  1. Pingback: ES 2015 - Worth the wait? - CodeJunkiiCodeJunkii

Leave a reply