Theory vs Practice

methodology bdd

Sat Feb 02 23:47:00 -0800 2008

Specs (or tests) show that your code works in theory. A running app in production shows that your code works in practice.

Put this way, the obvious question becomes: what’s the point of BDD? Working in practice is what matters.

Actually, both are equally important.

I’ve worked on (and created, in my less-enlightened past) lots of apps that are thrown together collections of PHP pages, ad-hoc daemons, and so on. These apps work in practice, but not in theory. They’ve been jury-rigged and duct-taped into working in practice, but when the first earthquake comes along they fall apart.

Another way to state this is:

  • Code that works in theory is code that works by design.
  • Code that works in practice only is code that works by accident.

Code that works in theory may not work in practice - only production deployment can tell you that. An app which has a large suite of running specs, but no users, is really no better than a non-speced, jury-rigged / it-works-if-you-just-don’t-jiggle-it-too-hard app. Only when it has been proven in both theory and practice is your app truly sound.