in reply to What is maintainable perl code?

A lot of people above have posted some good stuff about maintainable perl "style" and a few have posted about reusing a good library (that is CPAN); however I think maintainable code is maintainable code is maintainable code (apologies to Gertrude Stein).

It really doesn't matter what the language is (Perl, C, C++, Java, Python, etc) or the method (structural or object oriented). The key to maintainble code is decomposition (structural -> functions or subroutines, object oriented -> classes and methods) and ensuring your decomposed code follows the "High Cohesion/Low Coupling" mantra. Ensuring your methods/functions/subroutines/whatever do one thing well and "live" fairly independent (all necessary info is either "passed" in or lives within the object) is the nirvana of maintainable code.

-derby

Replies are listed 'Best First'.
Re: Re: What is maintainable perl code?
by Django (Pilgrim) on Sep 20, 2002 at 09:34 UTC

    That's a good point. The solid base of maintenance is the overall design imposed on the code - the way how bits and pieces work together. Perl doesn't imply nor exclude any specific methodologies - so this core aspect of maintainability is decoupled from the language itself.

    Readability is certainly an aspect of maintainability too, but it's also a matter of taste. Few (no?) other languages offer the large variety of phrasings that Perl does. That can make it hard for non-Perl folks to understand immediately, but it allows you to code close to natural languages on the one hand, or to compress complex algorithms to small chunks of code and explain in comments on the other hand.

    That's why I would say that Perl is designed to meet exactly that level of maintainability that you want.

    ~Django
    "Why don't we ever challenge the spherical earth theory?"

      Readability is certainly an aspect of maintainability too, but it's also a matter of taste. Few (no?) other languages offer the large variety of phrasings that Perl does. That can make it hard for non-Perl folks to understand immediately, but it allows you to code close to natural languages on the one hand, or to compress complex algorithms to small chunks of code and explain in comments on the other hand.

      I wish I could have said it that well.

      -disciple
Re: Re: What is maintainable perl code?
by vek (Prior) on Sep 20, 2002 at 16:00 UTC
    Ensuring your methods/functions/subroutines/whatever do one thing well and "live" fairly independent (all necessary info is either "passed" in or lives within the object) is the nirvana of maintainable code.

    Amen brother.

    derby++

    -- vek --