Peter Lind wrote:
On 24 March 2010 16:48, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
But now Dalmation_construct1 isn't related Dog_construct1. This seems
problematic from a design perspective unless I'm missing something in your
proposal.
As for abusing class semantics ... I don't see
it. Using separate classes for different things is what OOP is about.
If your constructor is trying to do 15 different things you're
designing it wrong - methods shouldn't have to rely upon massive
switches or the equivalent done using foreach loops and arrays.
Sorry, switches, foreach, and isset are not equivalent. My approach is O( lg
n ). Foreach and switches are O( n ) to find a candidate. Additionally, my
constructor does 1 thing, it delegates to the appropriate constructor which
does one thing also... builds the object according to intent.
Well that clarifies a whole lot in my mind. Although I do prefer my
particular take on it, yours is obviously quite clean also :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php