Do Repeat Yourself

It seems most developers has listen too much to the principle of “don’t repeat yourself”, and so otherwise bright developers in some cases strive too much to avoid repeating themselves and makes a mess of their systems but avoids repetitions completely. If your developer and reads about the DRY, do also remember the important step one: Think.

I’m basically all for DRY. Endless repetitions of the same lines of codes is a pretty bad idea and should be avoided.

The problem is – however – that not all programming languages and all technical setups are equally suited for deleting all repetitions, and thus the price you pay to avoid the repeats is that your code may become and endless mess of co-dependencies, cross-includes and all other “blur-ification” of what was once pretty and easily readable code.

When you start refactoring with DRY in mind do look carefully at what the costs are. Isolation joint code together in functions and clsses do make it much more important to have understandable names (for classes, methods, variables, parameters and file placement).

A little repetition may be okay, if it saves you a load of complexity and dependencies in the source code.