Friday, April 02, 2010

Fire Alarms and Software


Some years ago, I got into the habit of using fire alarms as a metaphor for continuous integration and automated tests. My take was that organizations were always holding back resources to get servers for continuous integration, especially where project funding was provided by the business side. Simple reason: the management didn't really grasp concepts like automated tests and CI. I know that the metaphor doesn't completely fit in many ways, but it's a nice way to communicate the urgency and importance of having this security around. So I started using terms like "security net" and fire-safety to illustrate our need for a build-server.


It also is a handy metaphor when convincing developers to write tests for their code. Many developers fail to see the immediate benefits of practicing TDD, for example, but everyone has the fear of fire, or letting a bug slip by and into production.

I like comparing the team to the fire squad in a small city. The more fire alarms we've got distributed throughout buildings in the city, the bigger chance there is that we will get there in time to put out the fire and prevent any serious damage. For software, the more unit tests we've got distributed throughout the components in the code base, the bigger the chance that any bug-causing commit will break the build, and we can "move out" out and fix it.

Even though a smoke detector is not a guarantee that fire will be discovered in your apartment, having one in every room will drastically increase the chances that fire is detected. You could say the same for unit tests, and stopping bugs from getting into production.

You can use the metaphor to explain some related (mal)practices as well:
  • Having bad code is like having lots of flammable material lying around.
  • You can passively enforce safety by building fire-resistant material. This could be good code.
  • Your production error logs and exception handling are like fire alarms.
  • I might be stretching it a bit far here, but sprinklers could be like fail-early systems. Components that shut down in case of bugs, preventing any more damaging usage.
  • 30% of smoke detectors are said to be non-operating (faulty, batteries, etc). You could use this to explain that your tests need maintenance as well.
Well, like any metaphor, it can be taken too far, so I'll stop there.

PS: A funny thing about apartments here in Germany is that there aren't so many smoke detectors around. I'm sure that there are plenty of smart people who get these for their own safety, but it's not required by law. In Norway you are required to have at least one smoke detector in every house or apartment.