Flexible View Manipulation

Patterns for Flexible View Handling, Part 1 – Working with Composites

Flexible View Manipulation

Ever since MVC started making inroads in the PHP community, the acronym’s “V” has been unfairly reduced to the level of a plain template whose responsibility was limited to rendering a few HTML pages, but views not only can be full-fledged objects carrying state, but also observers of a model, flexible enough to accommodate and react accordingly to fluctuations whenever the model’s state changes. In this two-part tutorial you’ll see how you can implement from scratch a couple of customizable view handling modules by sinking our teeth into the goodies of the Composite and Decorator patterns. In this part we’ll focus on the Composite pattern.

This entry is part of the series Flexible View Manipulation

© 1998-2012 SitePoint Pty. Ltd. All Rights Reserved