Don’t call us, we will call you?

Computer Languages
Don't Call Us, We Will Call You
Don’t Call Us, We Will Call You

Do you know “What is Inversion of Control”? If your answer is YES, then move on to the next Article. Otherwise read this Article, learn something and Please leave any questions or ideas for improving this article in the comments below!

Don’t call us, we’ll call you is a Hollywood Principle ,which is also called as “Inversion of Control”.

Inversion of Control is a common phenomenon that you come across when extending frameworks.

Table of Contents

Wikipedia Says,

The most important difference, and in fact the defining difference between a library and a framework is Inversion of Control.

So We should know what is difference between library and framework!

[table id=3 /]

In Details all the control flow is already in the framework, with more Library file built in. In order to use it you need to insert your code into framework structure i.e if i want to view a content in webpage, then i will place it under inbuilt html folder offered by framework itself. The framework’s code then calls your code at this points.

You don’t understand it? No problem! If you are a more visual learner, here are some diagrams that make it clear:

Framework Vs Library
Framework Vs Library


We are writing code into Structured framework. The framework Calls our code instead of we are calling it. So Control is inverted. This is called “Hollywood principle – Don’t call us, we will call you” Rule.

So good framework should Includes,

  • Don’t Call US, We will call you Rule,
  • Better Library File
  • Formatted Structure (MVC)

Etymology: As far as I can tell, the term Inversion of Control first came to light in Johnson and Foot’s paper Designing Reusable Classes, published by the Journal of Object-Oriented Programming in 1988. The paper is one of those that’s aged well – it’s well worth a read now over fifteen years later. They think they got the term from somewhere else, but can’t remember what. The term then insinuated itself into the object-oriented community and appears in the Gang of Four book. The more colorful synonym ‘Hollywood Principle’ seems to originate in a paper by Richard Sweet on Mesa in 1983. In a list of design goals he writes: “Don’t call us, we’ll call you (Hollywood’s Law): A tool should arrange for Tajo to notify it when the user wishes to communicate some event to the tool, rather than adopt an ‘ask the user for a command and execute it’ model.”John Vlissides wrote a column for C++ report that provides a good explanation of the concept under the ‘Hollywood Principle’ moniker.
Martin Fowler

Thanks to Senthil for helping me with my first article.