Dependencies injection pattern

The Hollywood principle (https://en.wikipedia.org/wiki/Hollywood_principle) is stated as "don't call us, we'll call you". One might hear this response after auditioning for a role in a movie. It won't work if the candidates call the recruiting agency every day. The agency would get swamped with calls if there were many candidates.

Instead, the agency will call back if they find someone suitable and want to take it forward.

This Inversion Of Control (IoC) applies to software designs too. IoC is different from other more traditional forms of programming.

Refer to https://techbizcurry.wordpress.com/2014/04/07/hollywood-principle-inversion-of-control-design-pattern/ for an excellent explanation.

Here is a real-world scenario. ...

Get Scala Functional Programming Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.