Thursday 5 December 2013

It's OK to Almost Repeat Yourself

One of the key tenets of modern (and not so modern) software development was catchily coined in The Pragmatic Programmer as the DRY Principle, Don't Repeat Yourself. This principle states that any information should only be defined once in an application, and that definition should have total authority. It doesn't matter where that definition is, but it should only be in one place. For instance, if you want to define VAT as 20% in your accountancy application, then that should only be defined once, and every reference to VAT should be a reference to the original definition. This principle should be applied at every level, so that every piece of code that does something of significance should only be written once (no copy-and-paste - that's bad).

In this blog, I'm going to say something absolutely heretical in the world of development and probably with it sink my reputation (if any scrap is left of it) to non-existent in the eyes of anyone who has any kind of education in software development. That the DRY principle can drive inexperienced developers into creating unmaintainable code.