Articles »

Refactoring to composition transform the superclass into an object of its own, which becomes the collaborator of the class under refactoring. Instead of inheriting every public method, the object will just expose the strictly needed methods.

This refactoring is one of the most underused in the PHP world. Don't be afraid to try out composition when you see duplicated code.
Posted by girish.r 481 days ago (http://css.dzone.com)
Discuss  | Bury | Tweet This | Tagged: practical php refactoring replace inheritance delegation
Add To 

Who Voted for this Story

Comments

No one has commented on this article yet.

Log in to comment or register here.