"be consistent" | |
PerlMonks |
Re: Re: Often Overlooked OO Programming Guidelinesby Ovid (Cardinal) |
on Dec 29, 2003 at 21:45 UTC ( [id://317562]=note: print w/replies, xml ) | Need Help?? |
Yes, you're correct. I used a rotten example. Here's a clearer example. A corporate customer is assigned to a company, which has an office which has a manager. my $manager = $customer->company->office->manager;Later on, we realize that this is a bad class heirarchy and the customer should belong to an office and the company is superflous to this, but we've hardcoded a chain of method calls and this makes life difficult. What if we had done this:
Now the fix is easy, when we want to drop the Company class reference in the Customer object.
Cheers, New address of my CGI Course.
In Section
Meditations
|
|