OBJECT-ORIENTED-PROGRAMMING5 MIN READ
Inject dependencies you need to replace
Decide when constructor injection is better than constructing a concrete dependency inside a class.
The email client is an external service dependency, so construction should move out of the behavior class.
Read the full lesson
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in