Skip Navigation
Trulia Logo

Trulia Blog

Leveling Up

At any fast-paced and successful company, there are areas of your codebase that are not-so-affectionately referred to as “legacy code”, and Trulia is no different. We’re always innovating and have done some amazing innovative things under incredible deadlines.

As we grow, we continue to learn from our mistakes and have made some great advances in performance and scale in line with our engineering organization’s goals. However, we noticed that we were spending too much time on maintenance, and getting bogged down in legacy code when developing new features.

Let’s be honest: writing tests for legacy code is hard. It’s a familiar catch-22: in order to write tests for untestable code you have to refactor; but in order to refactor, you need tests.

Another concern that is obvious to us is that our code is quite heterogeneous. Different people in and across teams use different patterns, styles and OO approaches when programming.

Stability and product execution is important to us: we needed to do something better.

The Solution: Training

blog pic 1

At Trulia we love doing awesome things with awesome people and decided to bring in two well-known trainers from Sebastian Bergmann (the creator of phpunit) and Stefan Priebsch (enterprise & architecture expert).

Looking at the size of our frontend engineering team (over 80 and growing!), it was clear that with the breadth of topics we wanted to cover with 2 trainers, we needed to create a custom, week-long program for the Trulia Engineering team.

For Trulia, it was worth setting aside our roadmap for a few days to make sure our team keeps doing what we do best: writing great code. In fact, this attitude is old hat for us—every quarter we spend an entire week innovating on new product & engineering features.

training photo2Together with Sebastian & Stefan, we constructed a program that consisted of a series of presentations, workshops, pair-programming, coaching and even team-sized focus groups per team. Loving iteration as much as we do, we modified the content and structure of the sessions daily as we learnt from our observations & feedback.

Now, we have an increased shared knowledge of testing, SOLID principles, patterns and other best practices that we can use for existing and new features. This not only helps us write new code, but allows us to know when & how to make our legacy code better (more testable and reliable).

One thing we learned about our legacy code is that it’s actually not as bad as you might think. Sure, there may be pieces in the wrong places, but with small changes to how we work going forward, it will become more testable and maintainable over time.

At Trulia, we believe that small is beautiful. This philosophy covers both how we design software (small methods, classes have a single responsibility) and how we work (small teams, refactoring the smallest part).

The Results

We learnt a great deal from this program and it’s inspired many of us. Here’s some perspectives from the engineers in training:

“I learned a lot and at the same time [the training] gave more confidence into myself to not be afraid of doing the right thing.”

“I started writings tests for a class I’ve been working on, and I found several bugs.”

“Over time, as you build tests on top of tests we create more and more business value, by being able to implement new features faster, proclaim higher quality of code, and lower maintenance costs.”

“This code is probably run a billion times a day. Making it more efficient will have a huge impact.”

Of course, it doesn’t stop there. Investing in our team is something we take seriously, and is an ongoing process. We will continue to invest and grow our team with future trainings, coding clubs, engineering forums and other goodies. Having an architectural vision for our software is critical for a team of our size, as it provides a guiding light for our design & code. Last year, we saw first hand of the benefits of following a vision, when we designed and launched Object-Oriented CSS (OOCSS). Nicole Sullivan talks about some performance & efficiency gains we achieved on her blog.

We are also building a wiki of patterns & solutions to solve common problems that are inline with our vision. A focus group now meets regularly to iterate on our architectural vision and refine our coding guidelines to help us all apply best practices.

Sound like something that interests you? We’re hiring. Check out current opportunities at