Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: best practice

by pmas (Hermit)
on Aug 28, 2001 at 09:15 UTC ( [id://108351]=note: print w/replies, xml ) Need Help??


in reply to best practice

++ to you for interesting discussion, George Sherston.

One thing what I like to do (and is seldom seen) is: Comments to mark what is ended by }.

I made my editor (MultiEdit) to use "templates", expandable on space. So, i.e. for if statement: after typying if on empty line and hitting space, MultiEdit "template" will expand whole if statement, like:

if (){ ; } else { ; } ### if
My "template" is created for me complete with ### if on the end (which I read END IF). And I sometimes even copy-paste logical condition from inside of IF. Why? When you have code over many lines, it's nice to see what statement is ended by }. And because template is doing it for free, why not use it, right?

I have templates like above for most statements (including sub) using advanced features of my editor. Sure enough I am using smart ident, but it's obvious, right?

So select carefully your editor, and learn all time-saving tricks what you can get from it. Editor is your first tool -- it is like gun for a soldier. It can save you a lot of pain - and help you with creating code in better style without any additional effort from your side - or as in my case with less effort.

I do not want to start holly wars about which editor is best, I just want to show an example how features of (a smart programmer's) editor can be used to help maintain better coding practices. Why to avoid Notepad. It's about lazines, not hubris.

pmas
To make errors is human. But to make million errors per second, you need a computer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found