Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Why programming is so much more than writing code

by bibliophile (Parson)
on May 08, 2007 at 14:28 UTC ( #614148=note: print w/ replies, xml ) Need Help??


in reply to Re: Why programming is so much more than writing code
in thread Why programming is so much more than writing code

Self-documenting code is good, yes. Necessary, even.

But at best it can only tell you *what* the code does. Sometimes the *why* is obvious, sometimes not. A good function name can help, but still....

Personally, I like to see even a one-line blurb on why the function exists. It helps me build (or re-build) that mental map of the system.

Something like:

# Data comes back from the DB sorted by x,y,z. # If the user wants a different order, here's where we do it.


Comment on Re^2: Why programming is so much more than writing code
Download Code
Re^3: Why programming is so much more than writing code
by blazar (Canon) on May 08, 2007 at 16:28 UTC
    Personally, I like to see even a one-line blurb on why the function exists. It helps me build (or re-build) that mental map of the system.

    But of course you're a bibliophile! ;-)

      :-) My secret is out!

      I do have one beef with code doc/comments... when the author's stated intention doesn't actually match what the code does.
      Is the comment out of date? Is the code flawed? Which do you start with?
      Having said that, though, I find that *way* more often than not, having a why-this-function-exists comment helps more than it hurts.

      Update: Darn it, I thought I was being all clever and stuff... turns out there's a whole thread dedicated to this topic. :-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-09-01 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls