Card image cap

ULISES
RAMIREZ-ROCHE

  • Software Developer
  • Javascript Specialist

At the beginning of the JavaScript Boom, very few people wanted to write any Javascript. But, with the advent of Node, and the roaring business of Web Apps, the power and profits were nothing to scoff at; the toy language wasn’t just shooting pellets anymore.

Many ryus of compilers were born, and their champions waged war against each other until one rose from the maelstrom, a paragon of Ruby named CoffeeScript, a creation of incest, which the Sorcerers of the Red Train would parade like a golden calf and elevate to the highest levels. The majority of the populace would not accept the religion of the Red Train and picked the version of JavaScript that tasted like vanilla, straightforward and unadorned, humble with a hint of lime. The pirate grog of es5.

Today, the flavour JavaScripts still exist but mostly through inheritance.  ES5 evolved from the ashes like a red swan after its journey into the Towers of Babel and is now formally known as es-whatever-year-this-is, but the People still call it Javascript. The answer is clear. Isn’t our existence too cruel and too short to work with dead tongues?

Still, in the darkest corners of the abyss, you’ll find this old anti-pattern roaming the halls of the web as a skeletal arachnid, the taste of coffee and a multitude of dead fruits heavy on your tongue,  forever begging the question like a raven.

Nevermore.

Excuse me?

Nevermore.

What is the meaning of this?

Nevermore.

IRL

Most of the time, out in the wilderness, this anti-pattern will take form as es5. The bugaboos stalking you are old friends. Watch out for var self equals this,  confusion about scope and inequality, and other creatures from the rat nest that you are well aware or you can always google at leisure.

var ENV = require("./env";

module.exports = React.createClass({
    render(){
     var message = ENV.hello ? "Hello World" : "Goodbye Cruel World!";
     return (
      <p>{message}</p>
     );
    }

 })

On the blue corner, you’ll find CoffeeScript. This caper is harder to pull. You’ll notice the previous programmers attempts at wrestling the language into shape, trying to form Ruby into a functional language. If you’re quiet, you can even hear the trains leaving the station.

/// 

module.exports = React.createClass
  render: ->
    var message = "Hello World"
    return (
      <p>{message}</p>
    )

 

Strategy

Migrate to ES6

The road to glory forks at es6. The best practice during the dawn of the apocalypse is to setup Babel and Webpack and venture from there. If you are migrating a brownfield project the most important thing is that you have some tests. You’ll need them even if the road seems safe at first sight.

Sometimes it’s best to start from scratch. Do so if you have that luxury.