Controller hierarchies and composite views

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Controller hierarchies and composite views

Post by alex.barylski »

Assume a base controller class which declares a composite view object.

The base controller class is then inherited from and extended. The sub-class needs to manipulate the view which is declared in the super-class.

Whats best and why:

1) Keep the view class as protected so derived classes have access to it - it's my common practice to keep variables private.
2) Provide the required API to manipulate the view in the base controller - starting to feel like MVP instead of MVC?

Perhaps a trivial view API such GetView() would suffice.

What do you say and why?
Post Reply