If you want m-inheritance, you can "include" (encapsulate is the word
i think) your smaller classes in "midware" and "big top-level" classes
that expose (part of) their interfaces. It's easy.

But guard against creating too many dependencies between different
smaller classes to and "bigger" classes.

Logic extending the features of more than 1 smaller class for a
special use-case should be in a "bigger" class that loads instances of
the smaller classes.
Do consider building 3 to 5 layers of encapsulation, when 2 seems not
enough. A class that includes & extends features for 2 to 4 "small
classes" is better than a class that includes 50 "small classes" for
widely varying features.

Logic extending the features of just 1 smaller class, even for a
special use case used only once, should be placed inside the smaller
class (possibly activated by an $options=array(), or maybe by adding
"_descriptionOfUseCase" to the function-name. That may seem to lead to
bloat, but zend will take care of that.

Ultimately, classes should provide abstractions of top-, mid- and
lower-level areas of business-logic.
They "govern" a "problem-area".

Case in point; adodb.sf.net; it does database abstraction, for many
different server types, and nothing more than that.
It's "finished", because all the "use-cases" you'll ever encounter in
the "problem-area" have been coded into adodb.

On Wed, Jan 27, 2010 at 1:52 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> Hi All,
> I know that a class can only inherit from one other single class in PHP,
> but how would I go about simulating a multiple class inheritance? For
> example, if I had several small classes that dealt with things like form
> generation, navbar generation, etc, how could I create a class in which
> these all existed?
> Or am I thinking about this the wrong way? Should I have keep the
> smaller classes, and have one larger object containing instances of each
> as and how are necessary?
> I've used classes before, but I'm fairly new to class inheritance, and
> more particularly, the complex inheritance like I describe here.
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to