Monday, May 18, 2009

Accidental Simplicity

Agile software developers favor simple designs that solve immediate problems, over feature rich frameworks that provide functionality that you may not use. The reason we agile people believe this is the right approach is that building extensibility adds costs, and spending resources (time and money) on something that may not be used is wasteful.

The approach of focusing on simplicity and shorter time horizons works well on agile teams because agile engineering practices such as unit testing and refactoring make it easier to evolve code when it needs change. Without this agile infrastructure teams can fall into the trap of code not changing because change is risky, and what was done first needs to be preserved. Working with the values of doing The Simplest Thing that Could Possibly Work, YAGNI (You Aren't Gonna Need It), and avoiding BDUF (Big Design Up Front) can help you build the right thing more quickly. The challenge is how to find a simple solution, as simplicity doesn't always happen by design. And it's important to remember that "simple" does not mean "no design" nor does a "simple solution" necessarily mean that it is a solution that does less.

Here are some things I try to keep in mind when looking for a simple, agile, solution to a problem:
  • To discover a simple solution it's worth thinking through at least 3 options. Even if your first one will be the clear winner, taking a small amount of time to consider the problem may lead you to a better more flexible solution
  • Clear separation of design concerns leads to more testable, simpler code. If it's difficult to write a unit test for the code that adds some functionality, maybe there is a simpler solution.
  • Simple design can be flexible design. Often the solution that is simplest to implement and test is the one that lends itself to extension.
While simple and flexible are not always correlated, it's important not to toss aside the things you know about good design when you are trying to do the "simplest thing..." Sometimes following good design and testability principles can lead you to a simple design, almost by accident.

No comments:

Site Reliability Engineering; The Book and The Practices

Site Reliability Engineering It’s difficult to walk into a software development organization without hearing about the discipline of Site ...