contents


preface
acknowledgments
about this book
about the cover illustration
 
1 Dependency injection: what’s all the hype?
1.1 Every solution needs a problem
1.2 Pre-DI solutions
1.3 Embracing dependency injection
1.4 Dependency injection in the real world
1.5 Summary
2 Time for injection
2.1 Bootstrapping the injector
2.2 Constructing objects with dependency injection
2.3 Metadata and injector configuration
2.4 Identifying dependencies for injection
2.5 Separating infrastructure and application logic
2.6 Summary
3 Investigating DI
3.1 Injection idioms
3.2 Choosing an injection idiom
3.3 Not all at once: partial injection
3.4 Injecting objects in sealed code
3.5 Summary
4 Building modular applications
4.1 Understanding the role of an object
4.2 Separation of concerns (my pants are too tight!)
4.3 Testing components
4.4 Different deployment profiles
4.5 Summary
5 Scope: a fresh breath of state
5.1 What is scope?
5.2 The no scope (or default scope)
5.3 The singleton scope
5.4 Domain-specific scopes: the web
5.5 Summary
6 More use cases in scoping
6.1 Defining a custom scope
6.2 Pitfalls and corner cases in scoping
6.3 Leveraging the power of scopes
6.4 Summary
7 From birth to death: object lifecycle
7.1 Significant events in the life of objects
7.2 One size doesn’t fit all (domain-specific lifecycle)
7.3 A real-world lifecycle scenario: stateful EJBs
7.4 Lifecycle and lazy instantiation
7.5 Customizing lifecycle with postprocessing
7.6 Customizing lifecycle with multicasting
7.7 Summary
8 Managing an object’s behavior
8.1 Intercepting methods and AOP
8.2 Enterprise use cases for interception
8.3 Pitfalls and assumptions about interception and proxying
8.4 Summary
9 Best practices in code design
9.1 Objects and visibility
9.2 Objects and design
9.3 Objects and concurrency
9.4 Summary
10 Integrating with third-party frameworks
10.1 Fragmentation of DI solutions
10.2 Lessons for framework designers
10.3 Programmatic configuration to the rescue
10.4 Summary
11 Dependency injection in action!
11.1 Crosstalk: a Twitter clone!
11.2 Setting up the application
11.3 Configuring Google Sitebricks
11.4 Crosstalk’s modularity and service coupling
11.5 The presentation layer
11.6 The persistence layer
11.7 The security layer
11.8 Tying up to the web lifecycle
11.9 Finally: up and running!
11.10 Summary

 
appendix A The Butterfly Container
appendix B SmartyPants for Adobe Flex
index