Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

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

APL? I had a friend (who was involved in building the engine monitoring software for the Rutan Voyager) described APL as a "write-once" language.

I don't think coding for readability and coding for maintainability are that much different. In either case, the program has to be written for an audience, and the chances are the audience will be less skilled. This may mean eschewing perfectly valid Perl, such as multiple statements on one line, or leaving in syntactically meaningless white space, or (horror!) putting in use English;, or adding parentheses that are not strictly needed.

I tend not to be too fussy about indentation (as long as it's reasonably consistent: 2, 4, 3, whatever is fine). I tend to dislike the practice of splitting long lines before operators, e.g.
$x = $a +$b +$c;

with "operator" including both arithmetic and logical operators.

I tend to keep my copy of Kernighan & Plauger's The Elements of Programming Style near to hand. Despite the examples being mostly in PL/1 and FORTRAN-66 (pdf file), most of the basic concepts are still applicable.

Probably the most extreme version of "readable code" is Donald Knuth's Literate Programming. I've never tried it (has anybody here tried it?)

emc

At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.

In reply to Re: What is code readability? by swampyankee
in thread What is code readability? by brian_d_foy

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 studying the Monastery: (5)
As of 2024-04-24 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found