News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Inversion of Control - The Hollywood Principle
December 10, 2012 @ 09:43:50

In this new tutorial on PHPMaster.com, Alejandro Gervasio looks at the Inversion of Control methodology and how it's more than just an abstract reference to dependency injection.

Traditionally, application components have been designed to operate on and control the execution environment, an approach that delivers well to some extent. [...] Instead of making the module completely responsible for logging data to multiple endpoints, we can transfer the responsibility straight to the external environment. [...] Not surprisingly, the process of inverting these responsibilities between components and the environment is formally known as Inversion of Control (or in a more relaxed jargon, The Hollywood Principle), and its implementation can be a real boost when it comes to developing extensible, highly-decoupled program modules.

He uses a set of domain objects (Posts and Comments in a typical blog structure) and the Observer pattern to show how mixed up things might get if the application isn't carefully coded. He takes this and updates it to include a "comment notification service" that implements the SplObserver and is attached to the post to be executed on an event (in this case, the setting of a new comment).

0 comments voice your opinion now!
inversionofcontrol hollywood principle introduction listener observer tutorial


blog comments powered by Disqus

Similar Posts

Felix Geisendofer's Blog: Screencast #1: Using vendor branching and CakePHP

Errumm.co.uk: My first experience in building a FaceBook Application in PHP

Francois Zaninotto's Blog: Chapter 10 - Forms

PHP Zone: PHP Access Control - PHP5 CMS Framework Development

DevShed: Developing a Form Validation System with the Observer Pattern in PHP


Community Events

Don't see your event here?
Let us know!


api series laravel xdebug extension opinion version symfony2 interview voicesoftheelephpant example podcast performance library framework release introduction php7 conference community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework