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
- Nobody Expects the Agile Imposition (Part VI): Architecture ("The Joy of Legacy Code" section)
- The Boy Scout Rule
- On Coding Standards and Code Reviews
- Why Create Coding Standards and Perform Code Reviews?
- Writing Solid CPAN Modules
- On Interfaces and APIs
- Computer programming (wikipedia) (See "Readability of source code" section)
- Patterns of Software by Richard Gabriel
- The Rise of Worse is Better by Richard Gabriel
- Beautiful Code OReilly book by Andy Oram and Greg Wilson
References Added Later
- How can I hope to use regular expressions without creating illegible and unmaintainable code? by faq_monk (Oct 8 1999! 2-3 months before PM opened to the public!)
- Maintainable code is the best code by dragonchild (2001)
- Maintainable code is the best code Part II by dragonchild (2001)
- What is maintainable perl code? by disciple (2002)
- Maintainable Code? by vek (2002)
- Should I leave behind beautiful code or readable code? by MaxKlokan (2007)
- Some thoughts around the "is Perl code maintainable" discussion by oyse (2007)
- I fear my code is unreadable by Boldra (2008)
- Beautiful code I wrote ;-) by Skeeve (2008)
- Clever vs. Readable by anonymonk (2008)
- Beautiful Code by ady (2009)
- Re^4: What's it with Perl Syntax ?! by me (2011)
- Making program readable by ravi45722 (2015)
- Yet another config file editing programme : Tell me how to make it better ! by dazz (2021)
- What determines the readability of a programming language (quora 2017)
- Why is Perl so dwarfed in data science by Python? (ycombinator, Jan 2022) (some comments about Python's magic powers of readability from data scientists in this long thread)
- Re^2: Organizational Culture (Part II): Meta Process (BioPerl/PDL/AI/Embedded/Data Science References) by me (2021) - the Why Perl Didn't Win essay by chromatic argues (convincingly IMHO) that to remain popular over time, a programming language must be compelling for new projects ... while further noting this is not solely a technical concern; it's a concern of the language community and ecosystem.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Some Help for a Report About Perl
by hippo (Bishop) on Nov 02, 2017 at 09:36 UTC |