The Hollywood Principle

The Hollywood Principle says: don't call us, we'll call you.

The sense of it is that we want our system having a clear path in dependency, to avoid the so called "dependency rot" where it looks like no one was really in control and any component is relying on someone else.

Accordingly to the Hollywood Principle the high-level component in our system controls when and how things happen. The low-level components can participate in the computation, but always under the control of the high-level one.

We can see this behavior in the Template Method pattern. There we have the high level component ruling the execution and its subclasses merely providing implementation details.

Chapter eight of Head First Design Patterns gives a good detailed introduction to this pattern. I'd suggest you to have a good read to the actual book, if you are interested in the matter.

No comments:

Post a Comment