Object-oriented design decisions should consider code testability.
A good test should be able to easily test any portion of the application.
Misko Hevery has great tips on how to design code for this purpose in his 2008 talk Don't Look for Things!:
- Class constructors should be simple, reduced eventually to only assignments.
- The use of Service Locator should be avoided (see minute 8:45).
- Dependency Injection (DI) is the solution to Law of Demeter (minute 19:14)
- Rules for object factories use (minute 22:00)
- Why NULL testing paranoia is bad for testing (minute 23:57)
- use of Google's Guice framework to build auto dependencies via reflection (minute 32:40)