This Google Talk provides an overview of the concept of Dependency Injection. It presents an excellent overview of how to separate the application logic and the builders/factories when writing code, so that testing becomes much more natural, self-explanatory and easy for both: logic and instantiations/wiring.
Check picocontainer and xunit testing framework.
Also google GUICE, a framework based on reflection to help with automatic generation of Factories.
Leave a Reply