16.4. When to avoid DI

We have nothing against using the latest technologies and techniques, but any good developer will weigh the pros and cons before incorporating them into their overall design—and it wouldn’t be unreasonable to assume these decisions are driven by a trained system architect. This is especially true of technologies such as cloud computing, libraries such as Hibernate, and techniques such as dependency injection. Although dependency injection has its benefits, there are several drawbacks that should be noted for the sake of completeness and should be taken into consideration when architecting your application.

First is the fact that dependency injection can lead to less-manageable and less-readable code. Sure, it removes ...

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.