SOLID Design Principles - Dependency Injection
Nothing is more pleasing than beautiful code. And nothing is more
heart-breaking than watching beautiful code get destroyed.
Lately, I’ve been paying particular attention to SOLID Object Oriented
Design (OOD) principles and their interaction with TDD. I’m finding that,
while TDD is an essential first step, it just isn’t enough. If I want my
code to survive the rigors of change and be useful for a long time I need
to armor it by following SOLID principles.
There’s a delightful symmetry in the feedback loop between TDD and OOD.
TDD in isolation is not guaranteed to produce well designed code, but if
you follow the OOD principles while writing the code you’re testing, TDD
gets easier and your tests get better.
In case you feel like pushing back already, let me add an early caveat. If
you...