The impact of testing on coding conventions

Tim Ottinger has a nice post on how TDD challenges your old coding conventions. Some of the changes TDD encourage include:

  • More interfaces
  • Singletons/static methods considered harmful (or at least hard to test)
  • Replacing private members with appropriate interfaces.
  • More factories, less calls to concrete constructors
  • Interface design by actual use (rather than anticipated use)
  • Dependency avoidance.

To quote Tim:

For the most part, TDD forces you to start doing the things you always should have done.