A Smooth Transition to ECMAScript 6: Using New Features

In part one of this miniseries, we talked about the timeline for ES6 rollout, feature compatibility in existing environments and transpilers, and how to get ES6 set up in your build process.

Today, we’ll continue the conversation, looking at some of the easiest places to start using ES6 in a typical front-end Backbone + React project. Even if that's not your stack, read on! There's something for everyone here.

If you want to try out the examples, you can use a sandboxed ES6 environment at ES6 Fiddle.

New Features

Classes, Shorthand Methods, and Shorthand Properties

A lot of client-side JS code is object-oriented. If you're using Backbone, just about every Model, Collection, View, or Router you ever write will be a subclass of a core library Class. With ES6, extending these objects is a breeze. We can just call class MySubclass extends MyClass and we get object inheritance. We get access to a constructor method, and we can call super from within any method to apply the parent class's method of the same name. This prevents us from having to write things like:

Backbone.Collection.prototype.initialize.apply(this, arguments)
Read More

A Smooth Transition to ECMAScript 6: First Steps

I'm really excited about the newest version of JavaScript, ECMAScript 6 (ES6). But I'm also terrified. There's already so much to do between mentoring, contributing to open source, and working on the projects that pay the bills. When will I ever find the time to learn a whole new version of JavaScript?

As developers, it's our blessing and curse to always be learning. When I think about getting ready to adopt ES6, I feel some anxiety about the thought of having to figure out all of the new patterns and APIs it exposes.

In this miniseries, we'll look at some quick and easy ways to integrate ES6 into what you're working on today. Hopefully, by adding ES6 patterns into our coding practice a little at a time, we'll be able to avoid spending a weekend learning the new API when we could be playing outside.

Looking Ahead to ES6

ES6 will be the first update to JavaScript since ES5 was finalized in 2009. ES6 was originally slated to come out in 2013, but was then pushed back a couple more times, and is expected to be finalized this month, June 2015.

There's a lot of JavaScript in programming these days.

Read More
Learn about Engine Yard
Try Engine Yard for your Ruby or PHP Apps

Cloud in My Coffee - Episode 3 with Gabe Monroy

After a month hiatus, it's time for your monthly dose of “Cloud in My Coffee”, the monthly video series from the Engine Yard Community Team. This video series features interviews with many of the people that make Engine Yard what it is every day. From the “C” level executives to those working the tickets on our Support Team, you’ll have the opportunity to get to know the Yardees around the world, all from the comfort of your seat, cup of coffee close at hand.

Read More

7 Patterns to Refactor JavaScript Applications: Service Objects

Note: This is part two (prev/next) of a seven part series that starts here.

Service Objects are objects that perform a discrete operation or procedure. When a process becomes complex, hard to test, or touches more than one type of model, a Service Object is useful for cleaning up your code base. Even a Service Object that performs one single step can be a valuable abstraction for clarity and testing.

To ensure isolation of a Service Object, follow these principles:

  • Strict with input and output. Service Objects are designed to handle a very specific process, so we can forego the Robustness Principle in favor of creating a tool for a single, specific purpose.
  • Documented thoroughly. Since Service Object code likely lives in a different file than the code where it is used (e.g. a controller or model method), the reader will not have the benefit of context when trying to understand what the Service Object is doing. Hence, documenting the argument types, logical paths, and return values is crucial.
  • Terminates after completion. This pattern should not be conflated with a worker process, which could set an interval, listen for web socket messages, or perform some other procedure with no immediate end. Service Objects should be invoked, perform their operations (whether synchronous or asynchronous), and terminate.
Read More

Middleman: Static Sites Aren’t Just for Blogs

When working on a new language, framework, or toolset, we’re often working with an example that wants us to build a blog. While blogs are great and easy to build, they are a limited in scope, and it could be we’re looking to build a different sort of static site—one that isn’t a collection of posts arranged by date. So what's the alternative?

Enter Middleman.

Middleman is a framework built for the purpose of creating simple static sites. Think of it as Jekyll, but for everything that isn’t a blog. And in this post, we’ll look at creating a simple static site with Middleman. This example was built using Ruby version 2.1.1p76.

Read More


Look through our specially curated posts to get focused, in-depth information on a single topic.