How Envato defined the expectations of our developers

The Envato development team has always had a strong sense of what we stand for, how we work together and what we expect of each other … at least that is what many of us thought. Around 9 months ago our company participated in the Great Places to Work survey, which gauges how our employees feel about Envato as a place to work. Each department received a breakdown of their feedback, and whilst much of our feedback was great, one statement was a clear outlier “Management makes its expectations clear”. This was a trigger to question our assumptions about those expectations. This post tells the story of that journey.

How to organise i18n without losing your translation_not_found

I’ve written before about Working with Locales and Time Zones in Rails, but I often feel the i18n library (short for internationalisation) is underused (appreciated?). Perhaps it is even avoided because of the perception it is more effort to develop with and harder to maintain.

This article will, I hope, open your mind to the idea that you will be better off using i18n in your application (even for a single language) and that it can be maintainable with some simple organisational pointers.

Envato Market Structure Styleguide

Today we have released the Envato Market ‘Structure Styleguide’ to the public.

A Structure Styleguide is a special breed of living styleguide, designed to document an application’s UI logic and all of the possible permutations of the UI.

The goal is to have a complete and shared understanding of how an application behaves in any situation, even in the most uncommon edge cases, without having to laboriously recreate each scenario by hand.

Your puppet code base makes you fear the apocalypse

Let me paint you a picture. At some point in time someone said ‘hey, wouldn’t it be great if we could manage our servers with that new puppet thing’. ‘Great’, said everyone, ‘Let’s do that and the way we have always done it.’. And that, my friends, is how you end up where we are.

Reading our puppet code base reads much like a bad folding story. Everyone had a plot line and tried to weave into a flowing narrative. And like all badly written stories it has many dead ends, twists, continuity issues and obscure meanings. You get that from many different authors - all code bases face the same problem.

Creating Form Objects with ActiveModel and Virtus

You might have heard of “fat models” referring to (mostly) ActiveRecord models turning into huge classes responsible for everything from user authentication to accepting attributes for entirely different models. This violates one of my favourite rules of [SOLID][solid], the single responsibility principle.

One of the patterns you can use to help balance your SOLID karma is with form objects. We use form objects extensively to back our forms and encapsulate the data submitted by a user.

It’s often tempting to reach for the ever ready ActiveRecord model when building forms in Rails because it Just Works™ with the Rails Form Helpers. I’m going to show you how to have your cake and eat it by backing your forms with objects.

Push Button Deployments

Envato is becoming a large company, with several teams working on many different products spread across various technology stacks.

Each of our teams are responsible for their own deployment process, which means each has ended up with its own way to deploy changes. It’s complicated to grant a new developer access to all the tools and services they need to deploy a single project, let alone multiple projects.

A Better Way to do Rails with Aldous

About a year ago the Tuts team encountered an issue with our Rails codebases becoming more unwieldy as they got bigger. Our development pace was slowing down and new features and fixes would cause regressions in unexpected parts of the system. This is a problem that many of us have encountered before, and we often treat it as part and parcel of doing business. This time, however, we decided to see if we could find ways to improve the situation.

Making the Most of BDD, Part 2

Hi, I’m Mary-Anne. I’m a senior Ruby developer here at Envato. One of the things that I love about my job is that it gives me the opportunity to use one of the practices I am most passionate about - Behaviour Driven Development, or BDD. In Part 1 of this 2-part series I described what BDD is and explained how it is more than simply a way to improve code quality. Today, let’s look at how BDD becomes the living documentation of your system, and how it informs your system architecture.

Chainable BEM modifiers

Envato Market has been using a css naming convention loosely based on BEM block__element--modifier syntax for the past two years and it has been instrumental in helping us update our front-end codebase and freeing us from legacy constraints.

About a year in, a problem was still bugging us. We had two different ways of using modifiers: single class and multiple classes.

Whilst both techniques are valid, they lend themselves for use in different scenarios. Plus, having two conventions using identical syntax in the same codebase is a recipe for confusion.

A Case For Use Cases

What’s the problem?

Most Ruby on Rails applications start off as simple web applications with simple requirements. As a developer, you take those requirements, map out the business domain and then implement it using the MVC pattern of models, views and controllers.

Over time, more requirements are added and simple controllers can become bloated with complex logic. The obvious next step is to create public methods on your models and move the logic into them, thus keeping the controllers simple. However, this inevitably leads to fat models.

One of the guiding principles of Software Design is the Single Responsibility Principle and fat models have too many responsibilities. In fact, you could argue an empty model that extends ActiveRecord::Base already has multiple responsibilities: persistence and data validation/manipulation. Furthermore, an empty ActiveRecord model contains 214 methods (not counting any of the methods on Object). So these classes are already tightly coupled to the Rails framework and if you put your logic in them too, they’re also coupled to the business domain.