Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Mandatory indenting

by Anonymous Monk
on Jun 18, 2003 at 00:39 UTC ( #266688=note: print w/ replies, xml ) Need Help??


in reply to Mandatory indenting

Damn, I don't even have to say anything, I'll just quote you:

  1. In Python, a programming language that I don't like much
  2. I have no idea how Python's indenting rules are, and don't really want to know either.

So you don't even know the most basic points about something, but you dislike it nonetheless? Sorry kid, this doesn't cut it.

Is Python flexible enough?

I have yet to see a situation where required, consistant block indenting causes anything more than the most trivial problems. I've been using it (and about 15 other languages) for years.

I wonder if Python people can hack up something to support curly delimited blocks in Python, without mandatory indenting.

Yes, we could. Very easily in fact, but we don't. Do you know why we don't bother? Consistancy. It's what Python has that Perl does not. It's what makes Python easier to learn than Perl. It's what makes Python easier to parse than Perl. It's what makes Python easier to test than Perl. It's what makes Python easier to maintain than Perl. It's what keeps me from having to worry about hiring programmers that write camel code for actual projects.

Perl has a lot of great features, but it takes providing multiple options too far. A language with less flexibility can be a very good thing.


Comment on Re: Mandatory indenting
Re: Re: Mandatory indenting
by tantarbobus (Hermit) on Jun 18, 2003 at 03:04 UTC
    Yes, we could. Very easily in fact, but we don't. Do you know why we don't bother? Consistancy. It's what Python has that Perl does not. It's what makes Python easier to learn than Perl. It's what makes Python easier to parse than Perl. It's what makes Python easier to test than Perl. It's what makes Python easier to maintain than Perl. It's what keeps me from having to worry about hiring programmers that write camel code for actual projects.

    Perl has a lot of great features, but it takes providing multiple options too far. A language with less flexibility can be a very good thing.

    So what you are saying is: if we dumb down the language, we can hire people that are not experts while still getting good quality clean code? I don't buy that.I have seen this several times; where a company's code in language X becomes unmaintainable because the code was written by someone who did not know how to program, and then the company hears the sirens' song of being able to get good quality code of non/Jr. programmers because language Y will not let them write bad code, only to find out that it is the programmer and not the language that dictates code quality. So all you end up with when you dumb down a language is a language that cripples experienced programmers while doing nothing to keep bad programmers from writing bad code.

    And when you say keeps you from having to worry about programmers from writing Camel code, I take it that you mean that it keeps experienced programmers from writing code that a novice would not be able to grok, a @bar = map {} sort {} map{} @foo for example? But how would python make, let us say, the VJ header compression code easier to read? In perl, the syntax just makes some things easier to read for an expert while being harder for a novice to read.

    -- It is the programmer, not the language.

    Disclaimer:

    I am in no way saying that python is a dumbed down language -- I have not used it before

      Every language I'm aware of allows you to write bad code. The differences between many of them simply boil down to how easy it is to screw up. Consistant languages with predictable behaviour will reduce development time, maintenance time, and the number of mistakes made. Obviously if you have expert Perl programmers writing the same code as novice Python programmers the Perl programmers will do a better job.

      The real question is what would the results be having a wide range of programmers of all experience levels of each language going head-to-head in a variety of real-world programming tasks. Perhaps it would be an interesting competition?

        Consistant languages with predictable behaviour will reduce development time, maintenance time, and the number of mistakes made.

        No, that's consistent discipline that has those effects. If there's a language that only allows one right way to do something, chances are someone else has already done it and you're unnecessary.

Re: Re: Mandatory indenting
by Juerd (Abbot) on Jun 18, 2003 at 09:47 UTC

    So you don't even know the most basic points about something, but you dislike it nonetheless?

    I know one basic point, namely mandatory indenting, and that single basic point is enough for me to dislike it. I'm not saying that Python is a bad language, because I simply don't know if it's any good. Python may be great, but its mandatory indenting keeps me from trying.

    Yes, we could. Very easily in fact, but we don't.

    Does Python have source filtering capabilities, then? Or would this require a hack in the core?

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      Python may be great, but its mandatory indenting keeps me from trying

      You definitly should try it, it is fun to code in python (though I didn't in the last nearly 2years, alas). The only thing I don't like is the inevitable OO-approach to regexps, but they have a real cute extension to perls: named captures (you can give names to the capturing parenthesis).

      While an anonymous sub is cool, a lambda as the function-arg to reduce did always put a smile on my face ;)

      I wouldn't do most of my admin-stuff and a lot of other work-stuff in perl if I followed this road: I hate(d) the sigils, and I was absolutly sure never to use perl.
      Well, I had to code a german public-health forum (external link) using slashcode. And now I'm in love with perl.

      Don't let such a thing fool you, in my experience you miss more in not using languages for such reasons, than the language looses in you not using it :-)
      always play a wee bit with it, beeing even if you're doing it for nothing else than to despise it for well-founded reasons.

      kind regards,
      tomte


      Edit:s/linke/like/

      Hlade's Law:

      If you have a difficult task, give it to a lazy person --
      they will find an easier way to do it.

      I know one basic point, namely mandatory indenting, and that single basic point is enough for me to dislike it.

      It seems to me like you're taking a idea from another paradigm and using it in your paradigm. See how the shoe fits its intended foot, not some other foot.

      I've had similiar discussions with a C programming friend of mine. He so dislikes Perl because you have to type ord to get the ASCII value of a char. He finds it completely silly. The fact that you rarely want to use ord in the typical Perl task doesn't occure to him.

      I think he does wrong in judging a feature of Perl like that. I think he should first try to grasp the whole concept of Perl--what it's for, why people like it, and how the pieces fit the Perl puzzle. If he then choose to dislike it I can respect his opinion.

      Take any piece of art (not fractals). Zoom in a lot. Can you appreciate its beauty now? Probably not.

      I can keep writing analogies all day, but I'll stop now.

      Just my thought,
      ihb

      PS. I realize you don't say that Python is a bad language, but I'm saying that you should evaluate mandatory indenting in a Python mind-set, not as a standalone phenomena.

        Take any piece of art (not fractals). Zoom in a lot. Can you appreciate its beauty now? Probably not.

        Mandatory indenting is not a detail, but a very obvious thing. You don't need to use ord in Perl, but you do need to indent in Python. If you don't like ord, you can create a wrapper around it. If you don't like mandatory indenting, ...?

        Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re: Re: Mandatory indenting
by TomDLux (Vicar) on Jun 18, 2003 at 10:19 UTC

    I find myself wondering, if Python is wonderful and Perl came out of a camel's behind, why are you reading, let alone posting on, this site?

    Personally, while I always indent my code to match its meaning ( thank you, emacs ), I prefer to have some punctuation to enforce my intent. And for those occassions when I cut and paste some text---no, no, I never do that, I re-factor, it's good to have braces delineating sub-components until I get them re-aligned

    --
    TTTATCGGTCGTTATATAGATGTTTGCA

Re: Re: Mandatory indenting
by herveus (Parson) on Jun 18, 2003 at 14:33 UTC
    Howdy!

    -- for lame anonymous reply.

    I have yet to see a situation where required, consistant block indenting causes anything more than the most trivial problems. I've been using it (and about 15 other languages) for years.

    ...long lines that you want to split and indent further? I can see that causing issues that I would not characterize as "trivial".

    Oh, consistancy is not all its cracked up to be. It can be a straightjacket. It may make learning easier in the early stages, but can impede advanced learning. Too much consistency can leave the language without enough conceptual texture. If everything works the same, how can you tell the difference. I don't recall where I saw the mention, but it was noted that natural languages have the most inconsistency in some of the most heavily used portions. Consider irregular verbs. Which ones are most commonly irregular? "to be" is frequently wildly irregular and is probably the most heavily used verb.

    Perl may be excessively flexible, but you are not required to use all the flexibility. As chromatic noted, discipline is key to the appropriate use of flexibility.

    yours,
    Michael

Re^2: Mandatory indenting
by Aristotle (Chancellor) on Jun 20, 2003 at 20:56 UTC

    I was going to write a retort here, but I won't bother since Larry has already done a much better job. The relevant section is at the bottom of the mail where he quotes Umberto Eco: "similar things should look different, because [otherwise], you end up with too little redundancy for effective communication." Consistency is not nearly what it's made out to be - which is why natural languages tend to be all but consistent. But then, you probably expected replies like this one on a site devoted to Perl - which raises the question of why you'd bother to post a node like yours on a site devoted to Perl.

    And then even if I a feel a desire for consistency at some point, I'll pick Ruby anyway.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2014-10-26 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (152 votes), past polls