
- 352 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
About this book
Dependency Injection is an in-depth guide to the current best practices forusing the Dependency Injection pattern-the key concept in Spring and therapidly-growing Google Guice. It explores Dependency Injection, sometimescalled Inversion of Control, in fine detail with numerous practical examples.Developers will learn to apply important techniques, focusing on their strengthsand limitations, with a particular emphasis on pitfalls, corner-cases, and bestpractices.This book is written for developers and architects who want to understandDependency Injection and successfully leverage popular DI technologies such asSpring, Google Guice, PicoContainer, and many others. The book exploresmany small examples of anchor concepts and unfolds a larger example to showthe big picture.Written primarily from a Java point-of-view, this book is appropriate for anydeveloper with a working knowledge of object-oriented programming in Java, Ruby, or C#. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Chapter 1. Dependency injection: whatâs all the hype?
- Seeing an object as a service
- Learning about building and assembling services
- Taking a tour of pre-existing solutions
- Investigating the Hollywood Principle
- Surveying available frameworks
âWe all agree that your theory is crazy, but is it crazy enough?âNiels Bohr
1.1. Every solution needs a problem
Figure 1.1. Email is composed locally, delivered across an internet relay, and received by an inbox.

1.1.1. Seeing objects as services
- Writing the message
- Checking spelling
- Looking up a recipientâs address
- Our Emailer is not cluttered with distracting code meant for text manipulation.
- We can reuse the TextEditor component in other scenarios (say, a calendar or note-taking application) without much additional coding.
- If someone else has written a general-purpose text-editing component, we can make use of it rather than writing one from scratch.
Table of contents
- Copyright
- Dedication
- 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