Four excellent talks by Miško Hevery on writing testable code: The Clean Code Talks — Unit Testing The Clean Code Talks — Don’t Look For Things! The Clean Code Talks — Global State and Singletons The Clean Code Talks — Inheritance, Polymorphism, and Testing