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 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.