7 Patterns to Refactor JavaScript Applications: View Objects

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

When a model has associated logic or attributes that are used exclusively for creating a representation of the model—as in HTML for a website or JSON for an API endpoint—a best practice is to avoid storing those values directly on the model.

Storing view-specific attributes on the model can create confusion about what is truth (stored in the database) and what is purely representational. View Objects, then, act as an adapter between the truth and the representation of the truth.

For example, the truth of an imagined inventory item is that the price attribute stored in the database is 599 cents. But the representation for the product page may be a mutation of the truth, such as $5.99.

It would be inappropriate to store the representational data as a secondary price attribute on the model. It would be even worse to inject the formatting logic into the template.

What View Objects do is dress up the data, by way of transforming, adding, or removing data properties, returning a new object for use in the presentation layer. This approach creates a nice home for our presentation-specific logic and attributes, keeping it removed from the model truth.

Read More

A Look at Rails 5

From the start, Rails was praised for being the easiest way to get Ruby on the web. It was the easiest option, and the best. Since then, many other options have arrived, but Rails is still the industry leading framework for Ruby developers.

As is tradition, this April at RailsConf 2015 in Atlanta, the creator of Rails, David Heinemeier Hansson (aka DHH) took the stage to announce what was new in Rails and to mark the release of Rails 5. This fits with the schedule of a major release every two years. And of course, folks were excited to get in early and see what our BDFL had to say about the future of Rails.

Here’s a look at some of the highlights.

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

Goodbye MVP, Hello v1

You've done it!

It all started with a simple concept and two friends in your garage. After weeks of coding and tweaking, you've proven that your business idea is the greatest thing since sliced bread. You used the Build, Measure, Learn cycle to find out what your customers want, and you're pretty sure you have a product market fit.

Now what?

It's time to build your v1. In this post, we'll look at how to take the most important lessons from the information you've gleaned during the MVP stage of your product's lifecycle and apply them to building the first full release of your product.

Read More

7 Patterns to Refactor JavaScript Applications: Query Objects

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

Database queries, even simple ones, can be both repetitive and hard to comprehend. With more complex queries, especially ones that embed data from multiple collections or tables, this process can become downright unintelligible.

Query objects provide a nice tool for extracting database query logic and associated operations into a contained module, pulling the logic out into a more maintainable and readable structure, while also providing a very readable API where the query object is used.

Read More

Announcing Deis & NYI: Containers on Metal

Today we are excited to announce a new partnership with NYI, a colocation provider that is now offering Deis-on-metal solutions to customers in New York, New Jersey, and throughout the Northeast. As you may already know, Engine Yard’s Deis is the leading Docker-based Platform-as-a-Service (PaaS) for deploying and managing distributed applications. As Deis has matured, we’ve seen more and more users running on bare metal. We’ve also learned containers on metal offer significant price benefits, consistent performance, and a strong security and compliance story.

As part of this partnership, NYI is providing Engine Yard with the power, space, and dedicated servers for a distributed systems lab that will be used to harden Deis for large-scale colocation environments. This lab will allow us to test failure modes, network partitions, and performance deltas between Deis releases. The lab will also help ensure container on metal solutions meet customer standards for high-performance, scalability, and high-availability.

We are excited to work with the NYI team to see Deis and containers on metal reach its full potential. If you're interested in an in-person demo at an NYI facility, or just want to learn more about Deis and containers on metal, please contact our customer success team.


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