Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Some thoughts around the "is Perl code maintainable" discussion

by blazar (Canon)
on Aug 12, 2007 at 16:45 UTC ( [id://632077]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Some thoughts around the "is Perl code maintainable" discussion
in thread Some thoughts around the "is Perl code maintainable" discussion

There's no such language where there is only one way to do things.

Well, not really: neither at the single statements and expressions level, nor at the "bigger picture one". But some languages push this "additional degrees of freedom" thing further than other ones: certainly Perl is a winner in this game. It's just a philosophy. Just like breeds of beer, it may fit some people and disgust others. So there's an opposite philosophy: TIOWTDI, which is of course limited in realizability since as you correctly say there can't be only one way to do it in the absolute sense of the word. But speaking of existing languages, Python is well and mostly known to outsiders for forcing indentation. And I remember clearly that at some point a specific feature of it was removed acrosse a release change because there was already another way to do the same, and that had to be the "official" one. Unfortunately I don't know it enough to give more details...

  • Comment on Re^3: Some thoughts around the "is Perl code maintainable" discussion

Replies are listed 'Best First'.
Re^4: Some thoughts around the "is Perl code maintainable" discussion
by MonkOfAnotherSect (Sexton) on Aug 13, 2007 at 06:38 UTC
    Note that Python's ideal/philosophy is not TIOWTDI (as is too-often straw-manned) but "There should be one-- and preferably only one --obvious way to do it.". This is more restrictive than TIMTOWDI but is somewhat aligned with "Easy things should be easy; hard things should be possible". The key bits there are:

    * "do it" - solve a particular problem.
    * "should" - language and library should be comprehensive
    * "obvious" - there should be a canonical way to solve a particular problem (even though there will be an infinity of other solutions, and a functionally equivalent technique may be the correct solution for a different problem).
    * "preferably only one" - Having only one canonical way to solve a particular problem encourages regularity of code. Regularity of code decreases the friction in picking someone else's code up.

    These are hardly ideals unique to Python, nor (unfortunately) does Python always live up to them.

    There is a price to Python's regular indentation and there are legitimate concerns people have with it, but 90%+ of complaints about Python's indentation are, frankly, kneejerk stupidity. The obvious way to structure a program in Python is to use four space indents, and editors do, but you can use whatever indentation you like as long as you indent sanely, and use line continuation/brackets if necessary. If you're masochistic you can program anything without indentation, but it's Very Very unpleasant.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-19 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found