Bryan R Harris wrote:
>
>>> No other perl programmers here, unfortunately. Good advice, though.
>> Why don't you post your ideas here for criticism then? I wouldn't post
>> an entire several hundred line script, but you could post your
>> specification and your plan for writing a code which met said
>> specification. If you're following a tutor, you could do the exercises
>> and post your answers here for criticism.
>
>
> Okay, here's one I struggle with often -- is one of these better than the
> other?
>
> **************************************
> A.
> if ( isFlat($tire) ) { changeTire($tire); }
>
> B.
> checkFlatAndChangeTireIfNecessary($tire);
>
> **************************************
>
> "changeTire" feels more elemental (?) and therefore more useful, but I can
> see why (B) would be attractive too...
>
> (B) is a ridiculous subroutine name, but at least someone would know what's
> going on with it. I started with just "checkTireAndChange", but how would I
> remember in 6 months that it only checks for flats and not nails?
Why not?
isFlat($tire) and changeTire($tire);
or
$tire->isFlat() and $tire->change( $spare );
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/