OOP Design Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello PHPers,

I have a collection of about 60 objects (class definitions).  They are
all very similar.  They all share a substantial % of the same core.  But
they all have slight variations as well.  The approach I took was to
make an abstract core class, and each of the 60 objects extends that
core.  This works, but...

Here's my problem, not every php/http request requires all 60 objects.
At this point, I do not know in advance which objects will be required,
so i include the class def of all 60 objects every time...  I don't like
this idea as it seems a 'bloated' approach.

So now i'm thinking instead i'll just have one object which has the
union of all the 60 objects' methods.  But i'm not too happy with this
either b/c (i) now each instantiated object is carrying around a lot of
unneccessary baggage, (ii) i lose modularity of code, and (iii) the code
does not make as much 'intuitive' sense.  For (iii), 'why does this
object have this method?' type questions another programmer would ask
(or me a year from now).  The answer would be 'efficiency concerns',
which i'm aware that you generally don't want to compromise code
readability for efficiency if avoidable.

Maybe this would be the perfect opportunity for the php autoload
functions...?

Thanks for your help/thoughts/comments,
dK
`

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux