Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
++ 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.


In reply to Re: best practice by pmas
in thread best practice by George_Sherston

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (8)
    As of 2014-08-02 08:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Who would be the most fun to work for?















      Results (55 votes), past polls