Wednesday, July 17, 2019

Effective Java Study Note - Prefer dependency injection to handwriting resources

Dependency injection is equally applicable to constructors, static factory methods and builder. It's useful when you need to pass an object to the constructor of the class or a class depends on one or more underlying resources whose behavior affects that of the class, greatly improves flexibility, reusability and testability.

No comments:

Post a Comment