http://qs321.pair.com?node_id=108351


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.