“Do The Simplest Thing That Can Possibly Work” – that’s what. Now, what does that mean?
The actual expression comes out of the XP camp. Supposedly it was originally a reminder to ask what is the simplest thing that could be done, but I actually prefer the active version.
I’ve been asked questions like this recently at work, and thought I’d take a moment out to write up my thoughts. That’s what this is for, after all… me. 🙂
Let’s break the statement down into component parts, shall we?
Do
This one is easy: you have to do it. Talking about it won’t help. Drawing up pretty pictures won’t help. Anything that isn’t actually doing the solution won’t help.
Simplest
A good way to break this down is to invert it. What’s the opposite of simplicity? Complexity. Thus, asking us to do the simplest thing is to ask us to do the least complex thing. This is good; software is already complex, and natural complexities will creep in without us adding unnecessary complexity into the picture. Adding unnecessary complexity has a very good description: over-engineering. Over-engineering is wasteful. Note that reducing complexity is hard; asking someone to produce the simplest design is to ask them to spend a lot of effort coming up with a better way.
Work
This is the caveat clause. A lot of detractors of this statement focus on the “simplest” statement and invent ridiculous strawman arguments. This clause demolishes them. If the solution doesn’t “work”, then it doesn’t meet the necessary conditions. If it does work, you don’t need to complicate it any further, do you? My personal definition of “work” is “passes all the tests”; this naturally puts the burden of proof onto testcases.
So, to rephrase this: DTSTTCPW asks us to use the least complicated solution that actually solves the problem at hand. Put it like this, it makes a lot of intrinsic sense.
Also: remember that XP is a “holistic” process. Slogans are like sound-bites: they are usually taken out of context. DTSTTCPW requires a lot of enablers, which a full XP process “just happens” to put into place. Above all, you need the ability to put in a more complex solution should the simplest thing turn out to not work after all.
Reblogged this on sonofbluerobot.
Hmm – how about “do the simplest thing that works”? I think it conveys the same message. And it is simpler: shorter and without the conditional “could”. So applying the advice to itself: you should not “do the simplest thing that could possibly work”, instead you should “do the simplest thing that works”.
And if those two are different, could you explain the subtle differences to me?
Because the qualifier “can possibly” encourages you to accept failure, and to look for something even simpler. Many people’s idea of “simplest” can often be made simpler _if they are willing to risk failure_.
Obviously, you need to test for that possible failure, and if it occurs, you need to get a bit more complex to deal with it.
A common scenario for DTSTTCPW occurs when doing TDD. Taking an extremely contrived example: if you have a test that calls `add(2, 3)` – and if that’s your only test – the DTSTTCPW rule says to write a an `add` method that returns a hardcoded 5. In order for your tests to justify anything more complex, _you need more tests_
My comment was only intended as a lighthearted remark about the irony that the phrase doesn’t seem to be the simplest expression of the idea.
But now that you take it more seriously – I must confess that I can’t follow your logic.
You give a clear, operative definition of “works”. A function either passes all tests – then it “works”, or it doesn’t pass all tests – then it “doesn’t work”. There leaves no room for a function that “could work”. So – with your operative definition of “works” – I don’t understand what it might mean that the “thing could work” vs. the “thing works”.
It seems to me that you want the phrase to be not only about WHAT one should strive for (“the simplest thing that works”) but also HOW TO GET THERE (“start at zero and add stuff until it works”).
And here I disagree. Because I don’t believe that “start at zero and add stuff until it works” will generally lead to the simplest solution. And I also don’t believe that complexity is generally the result of over-engineering.