> > write more than 100 line. Programming books teach you that it's
> > very difficult to manage bunch of code longer than 35 lines. Of
> > course 35 could be my limit while your could be 50 but I think that
> > evryone has a limit so we need subroutine.
>
> There are many methodologies. One that I learned was to structure
> your code into three to four layers.
>
> Top: Descriptive, broad areas of activity
> In interactive programs, often the main loop
> Middle: Sequences of actions for each major area
> Low: Detailed steps of actions
> Utility: Support routines
>
> This shop had unwritten rules AGAINST documenting the code with
> comments in the code. They firmly believed that if the code was written in
> a clear and lucid manner, it would be easier to follow than comments. I
I agree with that unwritten rule. If someone understands the
language in question then they should be able to follow the code.
About the 35 lines. I think it is a question of modification.
So many scripts I run into seem to be written in a stream of
consciousness manner. They work -- but they are difficult to follow,
and difficult to modify.
I think of what I am going to do and then put everything in
subroutines. I try to give the subroutine names an indication of
what they do. You can then look at the cluster of subroutine calls
to get an idea of what my program does. Oh, by the way, I set my
global variables prior to the cluster of subroutine calls.
I have started to write code to run under mod_perl. Ouch.. You are
suppose to be able to use any well-written code (assume use of "use
strict") but I find that that is not enough. I think I am getting
into a deeper level of programming. The scripts respond much
quicker.
I think that everyone who uses perl extensivley ought to move to
mod_perl or an equivalent. But it is a different piece of cake.
Peter
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------