To my parents
“If you want to make an apple pie from scratch, you must first create the universe.”
Carl Sagan
Copyright
Brief Table of Contents
Table of Contents
Praise from the Creator of Guice
Preface
Acknowledgments
About this Book
About the Cover Illustration
Chapter 1. Dependency injection: what’s all the hype?
Chapter 2. Time for injection
Chapter 3. Investigating DI
Chapter 4. Building modular applications
Chapter 5. Scope: a fresh breath of state
Chapter 6. More use cases in scoping
Chapter 7. From birth to death: object lifecycle
Chapter 8. Managing an object’s behavior
Chapter 9. Best practices in code design
Chapter 10. Integrating with third-party frameworks
Chapter 11. Dependency injection in action!
Appendix A. The Butterfly Container
Appendix B. SmartyPants for Adobe Flex
Index
List of Figures
List of Tables
List of Listings
1.1. Every solution needs a problem
1.1.1. Seeing objects as services
1.2. Pre-DI solutions
1.2.1. Construction by hand
1.2.2. The Factory pattern
1.2.3. The Service Locator pattern
1.3. Embracing dependency injection
1.3.1. The Hollywood Principle
1.3.2. Inversion of Control vs. dependency injection