Good design == the absence of design smells

One of the points that Bob Martin makes in his excellent book "Agile Software Development: Principles, Patterns, and Practices" is that the concepts of good design are hard to pin down, but examples of bad designs are plentiful. He lists several design smells that can / should be mitigated through refactoring, e.g. (if memory serves me right):

  • Rigidity: it is difficult to add new features
  • Fragility: small changes break the software
  • Immobility: the software is hard to reuse
  • Viscosity: it is easier to do the wrong thing than the right thing when making changes
  • Needless Complexity: the software is over-engineered or makes too many allowances for possible future scenarios
  • Repetition: the software violates the DRY principle (often when the team is infected with copy-and-paste-itis)
  • Opacity: the software is difficult to understand
Obviously these smells are interlinked, and opacity in particular is the root of many evils. But what is surprising is how often teams become immune to the presence of pungent odours in the code base: even when it is slowing them down and making them frustrated. So next time you open your IDE somewhere at random in your code just stop for a moment and breathe in: what are you smelling? And more importantly, what are you going to do about it? Smells just don't go away by themselves you know...