Slashdot Mirror


Is Perl Better Than a Randomly Generated Programming Language?

First time accepted submitter QuantumMist writes "Researchers from Southern Illinois University have published a paper comparing Perl to Quorum(PDF) (their own statistically informed programming language) and Randomo (a programming language whose syntax is partially randomly generated). From the paper: 'Perl users were unable to write programs more accurately than those using a language designed by chance.' Reactions have been enthusiastic, and the authors have responded."

18 of 538 comments (clear)

  1. Better? by Hognoxious · · Score: 5, Funny

    Better? How about we start with distinguishable?

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    1. Re:Better? by Chris+Burke · · Score: 5, Funny

      Indeed. This is the reason why the Obfuscated Perl Contest is run by the Department of Redundancy Department.

      --

      The enemies of Democracy are
    2. Re:Better? by Smallpond · · Score: 5, Informative

      Yet another ridiculous summary. The study wasn't which language was better, it was in which language can first-time users write a program more accurately. My guess is that Cobol would beat any of the three - it is designed from the ground up to be readable.

  2. Perl Is way better by PerlJedi · · Score: 5, Informative

    I'd have to say PERL is better than a lot of purposefully crafted languages. Its syntax is very forgiving, and there are lots of ways to do most things. Those two components are likely the reason this study came to that conclusion. This in no way means that PERL is not a good language. It does mean that many people can write PERL badly, but many people speak English badly and that doesn't reflect poorly on the language. PERL is, IMO, and should always be: Easy to do, but impossible to do "perfectly". But then I'm not sure that anything can truely be done "perfectly". Things may be done poorly, well, very well, or nearly perfectly, but to claim perfection is to deny the possibility of improvement.

    1. Re:Perl Is way better by Tridus · · Score: 4, Insightful

      "Its syntax is very forgiving, and there are lots of ways to do most things"

      That's probably why it's so commonly known as a write-only language. "Forgiving syntax" in particular usually leads to someone sitting around later trying to figure out WTF is going on.

      It's possible to write bad unreadable code in anything, but it's just so much easier in Perl that I shudder anytime I get asked to look at someone elses Perl code. That has NEVER been a good experience.

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    2. Re:Perl Is way better by gold23 · · Score: 5, Insightful

      I would suggest that perhaps Perl is particularly effective in separating good from bad programmers. In other languages, restrictions allow bad programmers to write code that *looks* good.

      But if you see readable, understandable Perl code, you know you've got a keeper.

      --
      Trust not a man who's rich in flax / His morals may be sadly lax
    3. Re:Perl Is way better by eriks · · Score: 5, Insightful

      This!

      Perl is a "beautiful" language -- in the same way some people talk about certain human languages (e.g. romance languages, Russian, or Sanskrit) being beautiful, as opposed to merely functional. Other people will disparage those same languages as being too this, or not enough that... the same kind of debate we see with programming languages, particularly with Perl, which is kind of interesting.

      And for some of those human languages, you'll also hear people lament how horribly some non-native speakers butcher them, perhaps because those non-native speakers are using them merely as a "functional" language, rather than grasping the full depth of expression that is possible.

      This analogy has at least some merit I think, since Perl is a language that was designed "linguistically" at least in some sense, in that it has the same kinds of patterns that natural languages have and is chock full of idioms and expressions, that some programmers (myself included) find not only useful from a functional perspective, but actually enhance the creative process that happens when one writes code. I think part of that is due to Larry Wall's now venerable "Programming Perl" -- which is one of the few truly valuable programming books that's also actually fun to read -- especially if you're one of those people that thinks at least a little like Larry, and enjoys a dry wit.

      Anyway, so yes, I totally agree, programmers that need "restrictions" in a scripting language to have their code be readable are definitely a certain "kind" of programmer. Not that they are better or worse programmers, they just don't embrace the TMTOWTDI philosophy, which is something that the society at-large doesn't generally embrace, so it's no surprise that there seem to be a lot of people that shit all over Perl.

      I've seen (in my own code and in others) truly beautiful and elegant Perl code that reads like a story, and also the "line noise" code people complain about. Which is really all about regular expressions. Some people really love 'em, perhaps a little too much. Though as has been pointed out probably a billion times, there's nothing wrong with one-off throwaway code that looks like line noise, but if you're building a giant system, then your code should be all pretty and commented and generally sociable.

      It's both unfortunate (and I still hope... a mixed-blessing) that Perl 6 has taken so long to come about. In that PHP went and pretty much took over it's niche as a web-development and "glue" language. Though the Perl community is still strong, if small, and I have no doubt that it will remain a living language for a long time to come, if for no other reason than the fact that CPAN is awesome, and there are zillions of lines of code written in Perl that a lot of people depend on every day, and that when Perl6 matures, I think it will enjoy a resurgence, within the Perl community, and perhaps much further, simply because of the simple and powerful philosophies that it encodes.

      Easy things should be easy and hard things possible.

  3. Re:Next question by Halo1 · · Score: 5, Funny

    How does C++ fair?

    Farely average.

    --
    Donate free food here
  4. Re:Trick question? by PPH · · Score: 4, Funny

    Hence the name: Pathologically Eclectic Rubbish Lister.

    --
    Have gnu, will travel.
  5. Not so fast.... by Ardeaem · · Score: 4, Informative

    They claim that Perl is not significantly better than Randomo, but that's just due to the test they chose. Looking at their figure, Perl programmers outperformed Randomo programmers in 6/6 tasks (that is, their means were greater). Using a simple sign test on the differences between the means, the two tailed p value is about 0.03, and the one-tailed p value (I think we're justified here having having a directional hypothesis...) is about 0.015. Both of these numbers are less than 0.05; we are justified in saying that Perl programmers performed significantly better than Randomo programmers, in spite of what the paper says.

  6. Re:Novices learning from whom...? by finnw · · Score: 5, Informative

    Yes it was Perl 4, which is one of the flaws in this study.

    --
    Is Betteridge's Law of Headlines Correct?
  7. Re:Quorum looks a lot like Pascal by h4rr4r · · Score: 4, Insightful

    Languages that consider whitespace need to die.

  8. Also... by Ardeaem · · Score: 5, Insightful
    They also say that

    While Perl has never had a particular reputation for clarity, the fact that our data shows that there is only a 55.2 % (1 - p) chance that Perl affords more accurate performance amongst novices than Randomo, a language that even we, as the designers, nd excruciatingly difcult to understand, was very surprising.

    This is a complete misunderstanding of what a p value means in statistical inference. The p value is not, and should not be interpreted as, the chance that "Perl affords more [or less] accurate performance." The p value is the chance, given that there is no difference, of obtaining a difference as large or larger. This is covered in first-year statistics.

  9. Re:Quorum looks a lot like Pascal by MoNsTeR · · Score: 5, Insightful

    If those punctuation marks (or keywords) make the code more readable, then they're not gratuitous are they?  I, for one, find brace-less languages fantastically hard to read, Python especially.

  10. Re:Novices learning from whom...? by Smallpond · · Score: 5, Informative

    "we did not train participants on what each line of syntax actually did in the computer programs. Instead, participants attempted to derive the meaning of the computer code on their own."

    They were not trained. They were just shown code samples with no explanation. The code samples had 1-letter variable names and no comments. The Perl sample uses $_[0} for getting the first sub argument instead of shift, and "for ($i = $a; $i = $b; $i++)" to do a for loop instead of "foreach $i ($a .. $b)", so it is deliberately obfuscated Perl.

  11. Re:Quorum looks a lot like Pascal by AJWM · · Score: 4, Interesting

    Fortran (at least, IV and earlier) totally ignored white space, even in the middle of an identifier. Of course, this led to problems like

    DO 10 I = 1.10

    meaning "assign the floating point number 1.10 to variable DO10I", when the programmer meant to type

    DO 10 I = 1,10

    meaning "loop from here to label 10 varying I from 1 to 10".

    An error something like this caused the Mariner II probe to Venus to go off course at launch and the Range Safety Officer hit the destruct.

    --
    -- Alastair
  12. Re:Quorum looks a lot like Pascal by Chris+Burke · · Score: 4, Interesting

    If those punctuation marks (or keywords) make the code more readable, then they're not gratuitous are they? I, for one, find brace-less languages fantastically hard to read, Python especially.

    I LUUUUURV Python so much that if it was legal I would marry it, but I completely agree. Curly braces to denote block starts and stops make the code easier to read and manage. I should not have to wonder whether a function or block continues past the bottom of the current screen's worth of code when it ends with a few lines of whitespace because I have to know the indentation level of the next line of code to know if it's in a different block context than the last line of code on the current page. I also should never have to wonder if I re-indented code correctly when cut/pasting or adding/removing a level of block nesting.

    I don't care if Python wants to keep the indentation requirements. Forcing the code of awful programmers to be more readable in this way is a good thing. Forcing all code to be less readable in another way is a bad trade-off. Just add in the damn braces! Then I can use tools to auto-indent for additional readability.

    --

    The enemies of Democracy are
  13. Re:Quorum looks a lot like Pascal by shutdown+-p+now · · Score: 4, Insightful

    Personally, I find that curly braces make code easier to read on top of perfect indentation. In truth, though, it's not so much the braces, as it is the nearly-empty lines of code that are spend to put those braces (note: this specifically applies to ANSI-style brace layout only, not K&R style). It creates a kind of a visual box, clearly delimited, with body of the block in it - more so than plain indentation does by itself.

    That said, I wouldn't call Python "fantastically hard to read", quite the opposite - it tends to be one of the easiest languages to read. Not because of indentation, but because its basic syntax is rather clean.