Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Help with Coding Style

by matze77 (Friar)
on Dec 26, 2009 at 10:29 UTC ( [id://814414]=note: print w/replies, xml ) Need Help??


in reply to Help with Coding Style

I would not think myself as experienced enough to give well advice, what i learned so far:
Try to write the code the way that others might understand it fast (maybe you find someone who could reread and comment ...).
Read the code a few days later (or weeks) and if you understand it fast thats a good sign.
Use alot of Comments especially on "more complicated code blocks". I try to add a few comment lines at top of the Script to explain to people not knowing perl what my script is doing (or should do ;-)), so these people could know if it might be safe to run it ...(for the sysadmin colleagues ...)
I am no friend of the many "cryptic shortcuts" on perl if the choice is there maybe write a little more if it is better understandable.
Warnings should be generally enabled.
Is a must, since it doesnt "exit|break" like strict.
I am not a friend "of strict using strict" (but you could disable on some code blocks if you want to use it, sometimes i think it makes life a little too hard esp. with $_. But on bigger projects it might help with some common errors, for smaller code snippets its "overkill" i think. So i wouldnt blame people for not using strict ...) Just my 2ct.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found