Readability vs Maintainability

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:

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.

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.

Habitability

Habitability is the characteristic of source code that enables programmers, coders, bug-fixers, and people coming to the code later in its life to understand its construction and intentions and to change it comfortably and confidently. Habitability makes a place livable, like home. And this is what we want in software -- that developers feel at home, can place their hands on any item without having to think deeply about where it is. It's something like clarity, but clarity is too hard to come by.

-- Richard Gabriel's Patterns of Software

Like Richard Gabriel, I prefer to aim for the more pragmatic "habitable code" rather than some perfectly abstracted ideal. And I admire Robert C Martin's homespun advice of "follow the boy scout rule and always leave the campground cleaner than you found it" because this simple rule gives hope to the maintenance programmer that things will improve in the future.

References

References Added Later

See Also

Updated: clarified Readability with wikipedia reference; added Habitability section.


In reply to Re: Some Help for a Report About Perl (Readability vs Maintainability References) by eyepopslikeamosquito
in thread Some Help for a Report About Perl by TDL4

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.