in reply to Re: Re: Re: Short routines matter more in OO?
in thread Short routines matter more in OO?
I hate dealing with code where methods only do one or two lines of action and there are many many such methods and subs.
So do I, so do I. I like short methods, not tiny ones :) I think screen page (24 lines) size is a good size for subs (methods or non-methods) and anything much larger should be taken apart.
Subs with only one or two meaningful lines are not what I was talking about when I meant short subs. They're a little too short :)
I do prefer one-line subs to five-line subs when it comes to often repeated code.
versussub property1 { my ($self, $value) = @_; @_ >= 2 and $self->{property1} = $value; # update: s/>/>=/ $self->{property1}; # update: s/property/pro +perty1/ } sub property2 { my ($self, $value) = @_; @_ >= 2 and $self->{property2} = $value; # update: s/>/>=/ $self->{property2}; # update: s/property/pro +perty2/ }
sub property1 : Property; sub property2 : Property;
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Short routines matter more in OO?
by tilly (Archbishop) on Oct 14, 2003 at 13:21 UTC | |
by Juerd (Abbot) on Oct 14, 2003 at 15:43 UTC | |
by tilly (Archbishop) on Oct 15, 2003 at 02:45 UTC | |
by Juerd (Abbot) on Oct 15, 2003 at 06:44 UTC | |
Re: Re: Re: Re: Re: Short routines matter more in OO?
by demerphq (Chancellor) on Oct 14, 2003 at 07:22 UTC |