Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Some Help for a Report About Perl (Readability vs Maintainability)

by eyepopslikeamosquito (Bishop)
on Nov 02, 2017 at 08:30 UTC ( #1202582=note: print w/replies, xml ) Need Help??

in reply to Some Help for a Report About Perl

Maintainability is the nebulous measurement of how easy it is to understand and modify a program. Write some code. Come back to it in six months (or six days). How long does it take you to find and fix a bug or add a feature? That's maintainability.

Maintainability doesn't measure whether you have to look up the syntax for a builtin or a library function. It doesn't measure how someone who has never programmed before will or won't read your code. Assume you're talking to a competent programmer who understands the problem you're trying to solve. How much work does she have to put in to understand your code? What problems will she face in doing so?

-- chromatic in Modern Perl ("Style and Efficacy" section)

Oh, one more thing. Don't fall for the old chestnut that "Python is more readable than Perl". Or that "Perl looks like line noise". Instead, remind anyone who makes such a claim that Russian is "unreadable" if you don't know Russian. Then further challenge them to explain how Python's magical powers of readability ensures that they:

  • Make sound domain abstractions.
  • Decompose their programs wisely into highly cohesive, loosely coupled modules.
  • Choose descriptive, explanatory, consistent and regular names.
  • Write useful comments.
  • Minimize the exposure of implementation details.
  • Avoid duplication (DRY).
  • Don't use magic numbers in their code.
  • Create interfaces that are: consistent; easy to use correctly; hard to use incorrectly; easy to read, maintain and extend; clearly documented; appropriate to audience.
  • Write components that are testable in isolation.
  • Establish a rational error handling policy and follow it strictly.

That is, "readability" is far less important than "maintainability" -- so that programmers who know the language can come to the code later in its life and understand its construction and intentions and change it comfortably and confidently. And writing "maintainable" Perl is just as easy as writing "maintainable" Python.

Update: Computer programming (wikipedia) defines Readability as "the ease with which a human reader can comprehend the purpose, control flow, and operation of source code" and further lists factors that affect it namely: following a consistent programming style (and naming conventions), correct indentation, judicious commenting and wise decomposition. Note that these important code qualities are essentially independent of the programming language being used.


References Added Later

  • Comment on Re: Some Help for a Report About Perl (Readability vs Maintainability)

Replies are listed 'Best First'.
Re^2: Some Help for a Report About Perl
by hippo (Chancellor) on Nov 02, 2017 at 09:36 UTC

    Quite so. It is always worth quoting from Ed Post:

    the determined Real Programmer can write FORTRAN programs in any language.

    I have seen this truism made real in more than one language as no doubt has everyone else who has been in the industry long enough. Thankfully there is not so much Fortranish Perl out there - it's probably the TIMTOWTDI which keeps them away.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1202582]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-06-21 08:16 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (98 votes). Check out past polls.