in reply to Some thoughts around the "is Perl code maintainable" discussion

Hi oyse,

TIMTOWTDI is a terrible thing. You finally get something working ... and then spend the rest of your life wondering whether there's a better solution.

Otoh, TIOWTDI would mean that once you have found a solution, you have found the best possible solution (as there is only one solution).

As a statement of fact, there's no doubting the truth of TIMTOWTDI, but I've long wondered about the presentation of TIMTOWTDI as a "selling point".

I guess the value of TIMTOWTDI over TIOWTDI is the implicit notion that if TIMTOWTDI, then you stand a better chance of finding a solution (at least under the laws of probability :-)

Cheers,
Rob
  • Comment on Re: Some thoughts around the "is Perl code maintainable" discussion

Replies are listed 'Best First'.
Re^2: Some thoughts around the "is Perl code maintainable" discussion
by jdporter (Paladin) on Aug 10, 2007 at 18:02 UTC
Re^2: Some thoughts around the "is Perl code maintainable" discussion
by vkon (Curate) on Aug 11, 2007 at 04:29 UTC
        Otoh, TIOWTDI would mean that once you have found a solution, you have found the best possible solution (as there is only one solution).

    by this logic, this is also the worse possible solution also!

    But I agree with commenters who say that there's not such a real-world language with only one solution everywhere.
    but languages having more TIMTOWTDI freedom give more freedom to programmer, but sometimes this freedom is not good, like in example by OP.

Re^2: Some thoughts around the "is Perl code maintainable" discussion
by ForgotPasswordAgain (Vicar) on Aug 10, 2007 at 14:26 UTC
    TIOWTDI would mean that once you have found a solution, you have found the best possible solution

    There are a couple of things that jump out at me here and scream bullshit.

    1) There's no such language where there is only one way to do things. You can always do things multiple ways, unless your knowledge of the language is limited to copy-pasting code. There's usually more than one algorithm to accomplish some task. For example, sorting -- is there only one way to sort in these supposedly TIOWTDI languages? I'd hope not, because they have no way of knowing the best possible sorting algorithm for your particular problem. (On the other hand, maybe that's the sacrifice you make for an easier to use system?) Even if there's a sort function that supposely solves all sorting the best possible way, there are some people who will use the language to badly reimplement a quicksort, etc..

    2) Assuming there was only one solution, do you really want to limit yourself to it? What happens when your application starts bogging down, do you just throw your hands in the air and say "well, it can't possibly be done better, since there is only one way to do everything"?

      There are a couple of things that jump out at me here and scream bullshit

      Well ... when one speaks with tongue firmly planted in cheek, there's always the risk that some observers will see only "bullshit".

      Still, it surprises me that you saw even one (let alone two) elements of "bullshit" in the statement "TIOWTDI would mean that once you have found a solution, you have found the best possible solution" - because, to me, that statement is tautologically true ... and you surely can't get a truer "true" than a tautological one.

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

      Agreed. And one therefore wonders why we perlers bother to mention the TIMTOWTDIness of perl - given that every other language offers exactly the same.

      Assuming there was only one solution, do you really want to limit yourself to it?

      Ummmm ... "assuming there was only one solution" would you have any choice other than "to limit yourself to it" ?

      Cheers,
      Rob
        Well ... when one speaks with tongue firmly planted in cheek, there's always the risk that some observers will see only "bullshit".

        Ah, right, you got me there.

        one therefore wonders why we perlers bother to mention the TIMTOWTDIness of perl

        I guess it's more propaganda than a statement about reality.

        "assuming there was only one solution" would you have any choice other than "to limit yourself to it"

        Yes, you could use another language.

      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...

        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.