On Tuesday 01 April 2003 12:36, Tony Esposito wrote:
| I am a strong proponent of the "top-down" approach.....I feel it makes my
| Perl code easier to read/follow.
| I quote from "Learning Perl" that "[The subroutine] definition can go
| anywhere in the program file, though
| most people put it at the end".
|

I agree with this approach and indeed this is how I generally code.

| > I try not to use too many subs as most of my scripting is short and
|
| simple, and I fear overkill if I do use subs. But your advice on mental
| powers seems to be true, I am now finding it difficult to cure what can
| only be a simple bug.
|

I learned once from a friend of mine who was quite proficient in programming 
that you should use functions as much as possible as it is similar to 
breaking the project down into little chunks to create the resolution to the 
big picture.  He also said that if you have a function that is larger than 
one to one-and-a-half pages then that function could probably be broken down 
into separate functions itself.

My rule is that if I have to type the same couple of lines over and over 
again then its time for a sub-routine or a loop.

Functions are a beautiful thing that assist in the creation of your program 
and allows for brevity and ease of maintenance.

Sorry...I just wanted to put my $.02 in. ;)

-- 

- Jim

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to