[JOB] Perl Software Developer and Database programmer
Nicholas Clark
nick at ccl4.org
Thu Feb 23 13:39:13 GMT 2006
On Thu, Feb 23, 2006 at 01:30:07PM +0000, Dominic Mitchell wrote:
> On Thu, Feb 23, 2006 at 12:08:08PM +0000, Peter Hickman wrote:
> > A particularly irksome idiom is:
> >
> > sub whatever {
> > my $value = shift;
> >
> > # Loads of code
> > my $other = shift;
> > # Loads more code
> > harry(@_);
> > }
> >
> > Don't even go there.
>
> But this is actually the /correct/ idiom for OO code:
>
> sub mymethod {
> my $self = shift;
> my ( $arg1, $arg2 ) = @_;
> ...
> }
>
> ie: shifting the object of the front of the arguments array because it's
> not really part of the arguments.
You are ignoring the significance of "# Loads of code"
Not having your argument processing in one place isn't the correct idiom in
anyone sane's book [*]
Nicholas Clark
* Except for sane people intentionally writing obfuscations.
More information about the london.pm
mailing list