Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You are on the right road, but it seems as if nobody has mentioned your solution is not good OO design: BAD: if ($po->status->name eq 'Sent') ... ALMOST AS BAD: if ($po->can_send) ... GOOD: $po->send You are breaking encapsulation in all but the last case. Getters are a design smell. They are just a way to make private data public. Instead of asking objects questions, tell them to do things. The object will figure out how to do it. Allen Holub says about this: "Never ask an object for the information you need to do something; rather, ask the object that has the information to do the work for you." In reply to Re: Short Refactoring Tip: let the object do it for you
by mvc
|
|