From: Brian
> 
> Why is it "good practice" to write PERL the way it is done?
> 

Discussing coding styles often degenerates into a religious and/or
political argument, but I will try an overview.

The purpose for arranging code in various styles is to assist the next
programmer on the project. While there are many individual styles and
idiosyncrasies, the basic intent is to provide visual clues to the
structure of the code. Think of this as an attempt to make it easier to
understand when looking at it for the first time. Since that first time
in some cases is the first time after not seeing it for six months by
the poor sap that wrote it in the first place, it is usually a good idea
to figure out some style and stick to it. Programming shops that
practice regular code reviews may even dictate a specific style.

There are a number of good books and articles on coding style floating
around. Some text editors can enable or even enforce certain styles and
there are "pretty print" utilities that will insert the extra indents
for you. But the idea is to think of the next person that will need to
understand this code. That might even be you, six month or a year from
now. Will you be able to figure out what you wrote, quickly, and be able
to modify it without breaking it?

If you care to notice, even the prose above has a certain style. No,
it's probably not great, but it does add some indication of structure to
what I have written. Hopefully it helps. If not, I can blame my high
school English teachers. None of them are around to defend themselves
any more.

Bob McConnell

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to