|
Posted by Hilarion on 09/06/05 18:43
> Yes I am sorry the example code was a poor example; I was quite tired and
> annoyed when I wrote it. The classes actually behave the way you say they
> should:
>
> - common_functions
> - entity extends common_functions
> - "thing" extends entity
>
> "Thing" will be the class to be actually instanciated, while some "things"
> can have subclasses (as page extends rubric, because a page needs all the
> properties and methods that a rubric has),
Consider using common base class (eg. "document_fragment") for "rubric"
and "page" instead of inheritance between those.
> and the relations between the
> objects are handled at entity level via parent and order properties - thus
> theoretically every kind of "thing" could be assigned to every other.
You should be more type-safe. I mean if the reference is always to an object
of specific class and is mostly used as the class, then you should make
sure, that it's always referred to as this class, not some base class.
Eg. you should use type hinting in PHP 5 and "instanceof" operator (in PHP 5)
or "is_a" function (in PHP 4 or 5).
Hilarion
Navigation:
[Reply to this message]
|