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:
Layer Supertype Pattern Encapsulating Common Implementation in Multi-Tiered Systems
July 04, 2012 @ 17:13:39

On PHPMaster.com there's a new post looking at a design pattern that's commonly in use by developers but they might not know its name - the Layer Supertype pattern and its use in multi-tiered systems.

Inheritance offers a straightforward way to easily spawn a large number of objects that are semantically related to each other without having duplicate code. The concept is ridiculously simple - yet powerful: you first drop as much logic as possible within the boundaries of a base type (usually an abstract class, but it could be a concrete one), and then start deriving refined subtypes according to more specific requirements. [...] Not surprisingly, this repetitive encapsulation/derivation cycle lays down on the formalities of a design pattern known as Layer Supertype.

They describe the "supertype" as a replacement for an overly bloated domain-related model. Their example replaces a PostInterface/CommentInterface with a more generic "AbstractEntity" that handles some of the basics for you - getting/setting, checking a field, setting an ID and outputing the information to an array.

0 comments voice your opinion now!
layersuprtype designpattern inheritance common logic


blog comments powered by Disqus

Similar Posts

Community News: Latest PECL Releases for 03.13.2012

Community News: Packagist Latest Releases for 07.08.2014

Community News: Packagist Latest Releases for 01.13.2013

Community News: Latest PEAR Releases for 01.16.2012

Community News: O'Reilly Offers PHP/SQL Certificate Series


Community Events





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


conference introduction opinion version library language tool composer interview voicesoftheelephpant series release list symfony security framework podcast laravel artisanfiles community

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