Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: What is clear code ?

by clintp (Curate)
on Apr 29, 2002 at 02:25 UTC ( #162746=note: print w/replies, xml ) Need Help??

in reply to What is clear code ?

Don't feel bad. Strictly on readability, I actually like yours better. Not necessarily because of the "number of concepts."

For me it's simply because it can be read top-down (instead of bottom-up). I despise having to visually scan down several lines for the semicolon, and scan back up to see what's being done. With all of the comments, yours is far more readable to me. Remove the comments, and his becomes much better. One grouping, one explanation.

Ovid's would be re-written as:

sub Readable_Ovid_Clear_MakePtag{ my $fixme = shift; # make newline-breaks into HTML paragraphs return join "\r\n", map { "<p>$_</p>" } grep { /\S/ } split "\r\n", $fixme; }

Replies are listed 'Best First'.
Re: Re: What is clear code ?
by Fletch (Chancellor) on Apr 29, 2002 at 14:06 UTC

    If you've done any Lisp (or other functional style programming) you kinda get used to parsing things inside out. You almost could wrap parens around Ovid's version and . . . :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://162746]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2018-05-21 00:17 GMT
Find Nodes?
    Voting Booth?