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

Re: best practice

by pmas (Hermit)
on Aug 28, 2001 at 09:15 UTC ( #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.

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2016-10-20 20:41 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (281 votes). Check out past polls.