Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re (tilly) 2: Style & subroutine organization

by tilly (Archbishop)
on Aug 30, 2001 at 00:48 UTC ( #108891=note: print w/replies, xml ) Need Help??

in reply to Re: Style & subroutine organization
in thread Style & subroutine organization

Item. When a single block goes over a page on your editor, your error rate jumps.

Item. When you write your program as a series of functions, it is easy to incrementally test your work as you develop it. Incremental testing helps overall code quality and improves overall development speed.

Item. If you develop your program as a series of functions, if halfway through development you find that you had a logic error, it is generally easier to adjust the overall program flow.

Item. When you make a habit of trying to make your code be more modular and reusable from day one, you start finding a lot more opportunities to reuse code. Reuse is one of those things that you won't find unless you always keep your eyes out for it.

Item. When you call a series of well-named functions, the result is code which clearly documents how it is supposed to work, but without the synchronization issues that scattering excessive comments can lead to. (Note that this is but one documentation need.)

There are more reasons listed at Re (tilly) 1: When do you function?.

Note that this is not a style that I learned, "In school." I studied math in school. Rather this is the style that is common to the best programmers I have run across in the workplace, on CPAN, and in books on good programming organization. Also note that the books on good programming technique that I am talking about are books like Code Complete and The Pragmatic Programmer. These are not books written by academics. Rather they are books written by experienced programmers with years in industry. Admittedly programmers who are willing to pay attention to academic research. But ultimately people whose opinions on programming are strongly influenced by decades of writing code.

  • Comment on Re (tilly) 2: Style & subroutine organization

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://108891]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2019-11-16 00:09 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (85 votes). Check out past polls.