Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Perl Contempt in My Workplace

by graff (Chancellor)
on Jan 17, 2022 at 09:22 UTC ( #11140523=note: print w/replies, xml ) Need Help??


in reply to Re: Perl Contempt in My Workplace
in thread Perl Contempt in My Workplace

Whenever I have an opportunity to mentor people in writing code, I tell them about this habit I've had ever since I became a reasonably good Perl programmer:

Every time you open a new, empty file that will contain source code, the first thing you should write into that file is commentary: a description of what this chunk of source code is supposed to do; its inputs and outputs; a synopsis of its usage and (where appropriate) an explanation of its default and optional behaviors. (Doing this as POD is the Best Thing Ever.)

Don't start writing the actual code until that part is done. (If, as the code gets written, you change your mind about anything, update the description accordingly.)

I've found myself repeatedly relying on this habit when it comes to being able to quickly grok code that I wrote years ago, or months ago, or just last week. It's also very helpful in keeping things clear in my head as I work on the code I'm writing this week.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-06-26 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (84 votes). Check out past polls.

    Notices?