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:
Decoupling Interfaces from Implementation - Using Separated Interfaces
June 14, 2012 @ 08:19:56

On PHPMaster.com today there's a new tutorial looking at using separated interfaces in your OOP applications, a design pattern that emphasized decoupled components.

Considering that the concept may sound rather tangled and twisted at first, this shifting of protocols between components lives and breaths under the umbrella of a basic design pattern known as Separated Interface, which at least to some extent, goes hand in hand with the commandments of the Dependency Inversion Principle. Moreover, because of the pattern's easy-going nature, it's feasible to implement it in PHP without much fuss.

He shows how to create a basic model (with getters and setters) and extends this into functionality to handle "Post" and "Comment" data types. The key to it all is that the "Comments" model instance is injected into the "Post" model on its creation, making it a self-contained, but still modular, object for handling all elements of a post in one place.

0 comments voice your opinion now!
decoupling tutorial separated interface


blog comments powered by Disqus

Similar Posts

Andy Frey's Blog: JavaScript PHP Remoting Demonstration

Gonzalo Ayuso: Combining Zend Framework2 and Symfony2 components with Composer to build PHP projects

DevShed: Developing a Captcha Application with an Image Generator Class with PHP 5

Abhinav Singh's Blog: How to use locks for assuring atomic operation in Memcached?

Till Klampaeckel: Continuous Integration: Automated database setup with Doctrine on Travis-CI


Community Events





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


unittest laravel series library zendserver install introduction opinion language community bugfix voicesoftheelephpant api release podcast deployment symfony package framework interview

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