Keep it Simple, but not Stupid

Along with TDD, which I’ve ranted about previously, one of the more misunderstood development practices of XP is the approach towards simplicity. Doing the simplest thing that could possibly work is not the easiest, laziest or most stupid thing that could work. However, as it turns out, this is a relatively difficult concept to communicate as well as a fairly difficult approach to put into practise.
This blog entry has been inspired by one of the Bill Venners interviews with Ward Cunningham titled The Simplest Thing that Could Possibly Work. Bill talks to Ward about how Ward and Kent came up with this principle of doing development focusing on simplicity. However, while this is a great article, I went away thinking, “well, Ward talks about simple, but he really doesn’t help me, or others, understand how to do that”.
So, I sat and thought for a while about what simplicity means to me and how I aim for it during design and development.
For me, simplicity of implementation is closely aligned to the principles described by Mary Poppendieck in her book Lean Software Development. These are related to minimisation of waste, and delaying of decisions to the last responsible moment. Minimisation of waste in code is making sure that at any point in time, we’ve got the code only implementing the functionality that we’re promising to deliver for that iteration (or release) and no more. Delaying of decisions also assists in keeping the code and environment to a minimum. In retrospect, how many times could the software have been developed, or delivered without the database, without the “important framework”, without the application server ? Certainly I know of many occasions the choices made in those matters have meant a more complicated environment that I’ve had to keep up to date for the entirety of the project. This just adds to my “inventory” of code and contributes to waste.
I can explain to people about how excess code means more maintenance and requires more attention. I can explain to people about how implementing a database and an application server early on in the development cycle requires more care and feeding during the course of the project.
I hear the cry “But what if I’d needed those”. In hindsight (a beautiful thing) in most occasions I could have implemented them later in the project with an absolute minimum of fuss.
Now, the process that I use to keep my code simple is as follows:

  1. Write a test that would help prove that my code meets the acceptance criteria
  2. Implement just enough code to make the test pass
  3. Search my code for duplication and/or things that look yukky and when I find it, I modify it to make it less so
  4. I now think of any other tests that need writing
  5. Go to step 1

Yes, I write my code in a TDD fashion. It’s not the only way, but I have found that it’s the easiest way for me to keep my code implemented in the simplest way. It’s a hard approach to take, because at every stage I have to fight the urge to introduce more code “just in case I need it”, but as each of the steps I take is fairly small, and I can focus on just making a single test pass I find I can keep control and keep my code simple.


2 thoughts on “Keep it Simple, but not Stupid

  1. I think this touches on the idea that achieving simplicity is not necessarily a simple process (see I wouldn’t call TDD complex, but it’s easy to view it as more difficult than simply “making it go.” And while TDD in my experience often leads to more readable and maintainable code, you need a lot more than a methodology to achieve that goal — you need to understand the “why” before the “how.” Gaining that understanding is often not simple, and I think that’s where the “stupid” part comes in. The design of a simple system is not stupid, but a “stupid” person should be able to understand it.

  2. I was amused to read a quote in Scott Ambler’s “Agile Modeling” comparing KISS with KICK (Keep It Complex, Kamikaze) which I think captures the sentiment with a little more precision and humour.
    Achieving elegant simplicty (best known as Occam’s Razor) is a universal problem and a
    common theme in science. My favourite quote is that attributed to Einstein – “Everything should be made as simple as possible but no simpler.”
    Have a look at

Comments are closed.