Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: I fear my code is unreadable

by FunkyMonk (Chancellor)
on May 06, 2008 at 22:50 UTC ( [id://685088]=note: print w/replies, xml ) Need Help??


in reply to I fear my code is unreadable

I just think I've gone a bit too far
My experience is that if you "think you've gone a bit too far" you know you've really gone way too far. Split your code up so that each line saves it's results into an array, and use that in the next step.

Doing that will make the code

  • self documenting (as long as you use sensible variable names)
  • easier to read
  • easier to test
  • easier to debug
  • easier to understand
  • easier to change

(And I'm as guilty as anyone else for making single statements too long and too complex)


Unless I state otherwise, all my code runs with strict and warnings

Replies are listed 'Best First'.
Re^2: I fear my code is unreadable
by Erez (Priest) on May 07, 2008 at 06:21 UTC

    I found that, although "self documenting" code is rarely found, good, clean, well-structured, and well styled code is more easily read, and better maintained.

    I suggest reading Tom Christiansen's Perl Style talk, and the article that influenced it, Rob Pike's Notes on writing C for some ideas and guidelines about style.

    Stop saying 'script'. Stop saying 'line-noise'.
    We have nothing to lose but our metaphors.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found