Skip to main content

XM Principle 3: Test-Driven Development

...also known as "red, green, refactor"

Before Joe started building a car, he created a model for predicting fuel economy. He identified over 100 well known, freely available parameters, like weight, drag coefficients, engine power, tire size, etc. Based on these parameters he could predict the EPA fuel economy of the car within a few percent.

Armed with this model, he was able to calculate the characteristics the WIKISPEED entrant must have in order to achieve not only 100 miles per gallon, but also to achieve performance characteristics worthy of a high-end sports car.

Team WIKISPEED wanted to achieve five-star crashworthiness according to the specifications of the NHTSA and IIHS. These specify impacts under multiple conditions to evaluate the crashworthiness of the cars. These tests are quite expensive, US$10'000 per test, plus the costs of the vehicle itself, transport and disposal of the test vehicle and the travel costs for the people involved. How can they update their designs every week, when each change requires retesting?

Step one was to use Finite Element Analysis to simulate the crashes. When they believed their car would pass the test, they ran an actual test. Of course they did not pass the test, but that was not the purpose. They wanted real crash data so they could better model crashes in their simulations. They updated their simulations based on the actual crash data. After a few iterations, their simulations became so good, that the authorities now accept the results of their simulations in lieu of actual tests. Since they can now do (almost) fully automated tests, they can simulate crash tests every week.

When designing new components,

  1. Create the test it is expected to pass. That can be very high level, like emissions tests or crash standards, or it might be more component level. If it is possible to automate the test (or create an automated proxy for the test), do so, as this reduces the cost of repeating the test after future design changes.
  2. Create the simplest design possible that enables the test to pass.
  3. Iterate on the design, improving it until it is more valuable to work on another portion of the product.

In software, this process is known as "Red-Green-Refactor." To implement something, first create a test, which by definition fails immediately ("goes red"). Then implement functionality to make it pass (go green). Then improve the design for better maintainability, efficiency, etc. This is called refactoring.

Next: Contract First Design

The 10 Principles of Extreme Manufacturing

Comments

Popular posts from this blog

Sample Definition of Done

Why does Scrum have a Definition of Done? Simple, everyone involved in the project needs to know and understand what Done means. Furthermore, Done should be really done, as in, 'there is nothing stopping us from earning value with this function, except maybe the go-ahead from the Product Owner. Consider the alternative:
Project Manager: Is this function done?
Developer: Yes
Project Manager: So we can ship it?
Developer: Well, No. It needs to be tested, and I need to write some documentation, but the code works, really. I tested it... (pause) ...on my machine. What's wrong with this exchange? To the developer and to the project manager, "done" means something rather different. To the developer in this case, done means: "I don't have to work on this piece of code any more (unless the tester tells me something is wrong)." The project leader is looking for a statement that the code is ready to ship.

At its most basic level, a definition of Done creates a sh…

Explaining Story Points to Management

During the February Scrum Breakfast in Zurich, the question arised, "How do I explain Story Points to Management?" A good question, and in all honesty, developers can be an even more critical audience than managers.

Traditional estimates attempt to answer the question, "how long will it take to develop X?" I could ask you a similar question, "How long does it take to get the nearest train station?

The answer, measured in time, depends on two things, the distance and the speed. Depending on whether I plan to go by car, by foot, by bicycle or (my personal favorite for short distances) trottinette, the answer can vary dramatically. So it is with software development. The productivity of a developer can vary dramatically, both as a function of innate ability and whether the task at hand plays to his strong points, so the time to produce a piece of software can vary dramatically. But the complexity of the problem doesn't depend on the person solving it, just …

Money for Nothing, Changes for Free

“Money for Nothing, Changes for Free” encourages both customers and suppliers to focus on value.

A key advantage of Scrum projects is that at least once per sprint you have something that could be shipped and no work in progress. You can change direction every sprint, and you can reevaluate whether the project is a good investment or if your money could be better spent elsewhere. Abrupt cancellation is risky for the supplier.

While the concept of an early-exit penalty is not new, Jeff Sutherland gave it a unique allure with his allusion to the Dire Straits hit.
Desired Benefit Incentivize both customers and suppliers to focus on functionality that provides genuine value.
Structure This works with Agile software projects because there is little or no work in progress. After each Sprint, functionality is either complete or not started. Work is basically on a Time and Materials basis with a cost target, often with the intention that the project should not use up the entire project budge…