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' }
In reply to Re: Re: Re: Re: Short routines matter more in OO?
by Juerd
in thread Short routines matter more in OO?
by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |