Practical PHP Patterns: Layer Supertype

Practical PHP Patterns: Layer Supertype

via dzone.com: latest front page by piccoloprincipe on 9/21/10


Duplicated code must be kept synchronized in all its copies, and distracts whoever reads a sourcefile from the peculiarity of a class. One of the simplest, and to a certain extent effective, solution to this issue is to introduce a Layer Supertype to avoid duplication, and move all the shared code in it. Then, having the Layer Supertype subclassed by the various classes to inherit the common members, which remain defined only one time in the Layer Supertype itself. But introducing a base class isn’t always a nice solution.

Comments

Comments are closed.