16.1. Dependency injection—the fundamentals
One of the goals in coding these days is to minimize the amount of code written. Sure, less code is easier to maintain, but let’s be realistic; the slickest code is the code that isn’t written at all. Boilerplate be gone, you could say.
Dependency injection allows us as developers to work with interfaces, and it lets code generators (and custom class loaders) provide the concrete class types. This technique works well in the following situations:
- Working with a framework or subsystem that has multiple versions
- Maintaining a multiplatform application (for example, a windowing interface on one platform might share the same interface as another platform, but their implementations are completely different) ...
Get GWT in Action, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.