1. Homepage
  2. Company
  3. Case Study: Trulia
 

Screenshot of the Trulia website
 

Trulia is a leading marketplace in the real estate industry. Trulia gives house hunters the information they need, provides an end-to-end offering for real estate agents, and offers rental listings across the United States.

Following almost ten years of rapid growth, the Trulia engineers felt that they spent too much time on maintenance of their existing code base. Their ability to deliver new features was declining and keeping up the performance of the software became a real challenge.

thePHP.cc taught the Trulia engineers how to effectively deal with the existing legacy code and work around its limitations by creating new code in a clean and testable manner.

 

A Victim Of Its Own Success?

Since 2005, Trulia has been building a software platform that enabled and supported the company's rapid growth. This required a strong focus on adding features that deliver value for customers and improve the user experience. Ten years into this way of working, some of the negative effects that come naturally with massive growth began to show. To keep up the performance of the software, and allow further scaling of the platform, the engineers found themselves spending more and more time on maintenance.

This situation is rather common for a successful business. As the size of the user base and the amount of data the platform works on increase, hitting limitations of any existing implementation is inevitable and just a matter of time. Trulia's code base was in danger to become a victim of its own success.

Kick-Off Workshop with Sebastian Bergmann and Stefan Priebsch at Trulia

Challenge and Innovation

To mitigate regressions due to the addition of new features, Trulia decided to invest in more test automation. A major part of the developers, however, felt that it was not feasible to test the existing legacy code with reasonable effort. This is why Trulia approached thePHP.cc for advice and guidance.

As a first step, thePHP.cc analyzed and reviewed selected parts of Trulia's code base remotely. This allowed the consultants to understand the developer's thought patterns, which best practices they embraced, and where they were missing out and needed to improve. Based on the findings of this review, two consultants created a schedule for a full week of training, presentations, and workshops alternating with individual coaching of the developers.

A successful trainer challenges existing thought patterns and questions solutions that are already in place. The key to success is to not only to explain better ways of solving problems, but to work with the developers and help them to apply the theory as part of their daily work right away. Thus, combining workshops that inspire developers and spark new ideas with coaching developers who work in pairs on real tasks guarantees great results.

Just like in agile software development, a plan is never set in stone. So while on site, the schedule was continuously updated based on experience and feedback.

Agenda for the week at Trulia
 

Shifting the Focus

The code review had shown that Trulia's engineers would need to put more focus on uniform solutions to the same or similar problems in order to implement efficient solutions that avoid code duplication and unnecessary effort. The schedule therefore had a particular focus on enabling know-how transfer across the teams and starting a discussion about best practices inside the indivdual teams as well as across all teams. One week is definitively not enough time for a team of 80 developers to achieve mutual consensus on all important topics, but it can seed a common understanding of promising best practices, which sparks off constructive discussions in the following weeks.

"When developers struggle with test automation, they usually need to change the way they write code", says Sebastian Bergmann, author of PHPUnit, the leading test automation framework for PHP, and one of the two principal consultants working on-site with Trulia. Together with Stefan Priebsch, a proven expert on software architecture and enterprise development, he made sure that Trulia's engineers would put more focus on testability as they wrote code. Both consultants made sure that everybody would work in small increments, quickly alternating between writing code and running tests, to get quick feedback and reduce waste. This way, most bugs are discovered and eliminated as the code gets written, rather than while testing the completed feature.

Into the Future

"I started writings tests for a class I've been working on, and I found several bugs.", says one of the Trulia developers, confirming the success of the new approach.

The consultants of thePHP.cc also put strong emphasis on the fact that legacy code must not influence the quality of new code. New code should always be written according to established best practices like the Clean Code or SOLID principles. Refactoring legacy code to follow those principles is cost-intensive and risky. Instead, bridge technologies should be used to integrate old and new code, which requires only minimal modifications to the existing code.

A dedicated workshop on bridge technologies and several hours of hands-on experience in various focus group sessions made sure that by the end of the week, this was a tried-and-tested best practice for Trulia that the developers had actively experienced.

Gathering discussion topics with the developers at Trulia

"As we got on site, most Trulia developers felt that their legacy code would prevent them from writing high-quality code. We demonstrated that writing new, clean code and dealing with legacy code are not mutually exclusive."

Stefan Priebsch, Co-Founder and Principal Consultant, thePHP.cc

"Sebastian and Stefan have shown us how our developers can keep delivering business value without getting sidetracked by our legacy code, and they have set us on track to reach a lot more common grounds between all our development teams."

Dave Rochwerger, Director Engineering, Trulia

About Trulia

Trulia Logo Since 2005, Trulia has been focused on building the most vibrant and valuable marketplace in the real estate industry.

Trulia gives consumers the information they need to make better decisions, providing house hunters with insights and unique information not just about properties, but also about neighborhoods and agents across the country. Real estate agents are provided with the industry’s first ever end-to-end offering, including best-in-class marketing tools and the broadest suite of software to help them build and manage their business.

Trulia's rental business offers rental listings across the US via dedicated apps and on the web. For people looking to buy a home, the mortgage center gives personalized, real-time quotes from lenders across the US.

Trulia attracts more than 51 million unique house hunters every month. The company is headquarted in San Francisco and has offices in New York City, Denver, and Bellevue.

The community is important for us.