Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

A couple of my tips on style, regardless of language.

Strategy in comments, tactics in code. Don't explain every statement or operator, but explain the goal of the following few statements or chunk of code. Another suggestion is to write the comments first as you're thinking about what you want to get done, then "translate" the intent into implementation. Don't write clever code which needs explaining-- just accomplish the tactics simply and directly.

There are only three numbers in Computer Science. Zero, One and N. Zero refers to the complete lack of something: no variable, no method, no capability, no support. One refers to a sole solution: one variable, one method, my way or the highway. N represents an arbitrary scalability, an array which can grow, a method reference, a parameterized technique with room to expand. If you find a need for two, structure your code so it can handle three, four or more. That goes for allocations, methods, strategies, resources, resource types, everything.

--
[ e d @ h a l l e y . c c ]


In reply to Re: Re: IYHO, what do you consider good code? by halley
in thread IYHO, what do you consider good code? by stonecolddevin

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-18 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found