Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Perl Programming

Is Perl Better Than a Randomly Generated Programming Language? 538

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."
This discussion has been archived. No new comments can be posted.

Is Perl Better Than a Randomly Generated Programming Language?

Comments Filter:
  • by Tridus ( 79566 ) on Thursday October 27, 2011 @05:19PM (#37861536) Homepage

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

  • by h4rr4r ( 612664 ) on Thursday October 27, 2011 @05:33PM (#37861696)

    Languages that consider whitespace need to die.

  • Also... (Score:5, Insightful)

    by Ardeaem ( 625311 ) on Thursday October 27, 2011 @05:33PM (#37861714)
    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 [wikipedia.org] 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.

  • by gold23 ( 44621 ) <org.slashdot.2NO@SPAMoolong.com> on Thursday October 27, 2011 @05:36PM (#37861756) Homepage

    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.

  • by narcc ( 412956 ) on Thursday October 27, 2011 @05:45PM (#37861852) Journal

    Well said.

    If you want your code properly indented, just indent it. It's like the Python apologists are incapable of formatting their code properly unless the language forces its particular version of "properly" on you.

    Before the trolls fire back: In the case of code written by others, run it through a pretty-printer. Problem solved. Oh, as a bonus, you can use that same tool to format code the way you prefer, and switch it back to whatever style your company requires at the press of a button. Why is this a bad thing?

  • by grcumb ( 781340 ) on Thursday October 27, 2011 @05:49PM (#37861902) Homepage Journal

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

    One could - quite validly - say the same about the English Language.

    Now, I'll grant programming and spoken/written languages don't overlap perfectly with one another. That's why languages like LISP have such elegance; what they're designed to express is something far more abstracted and formalised in nature. It's possible to conceive of a complex structure and accompanying set of behaviours and properties simply by scanning a screenful of LISP, but English is narrative in nature. You don't scan across; you scan from top to bottom.

    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.

    Perl can be difficult to grok, but it can be elegant as well. I've experienced revulsion looking at Perl code before, but never so consistently as with ASP and PHP. These are languages (and I use that term loosely) that simply cannot be made pretty.

    In the right hands, Perl can be as elegant and expressive (and opaque, and efficient) as Shakespearean English. Argue however you like, the same is not true of many other languages. Python has clarity and simplicity. It's truly an engineer's language. LISP, as I've said, is beautiful in the same way architecture can be beautiful: taken as a whole, rather than a story. I didn't understand the appeal of Ruby until I learned that its inventor is Japanese. Then it all became clear. What seemed like awkward, nearly backward syntactical constructions suddenly made sense.

    In other words, horses for courses. But arguing that Perl is not readable in its very nature is like arguing that English in incomprehensible based entirely on watching Jersey Shore.

  • by MoNsTeR ( 4403 ) on Thursday October 27, 2011 @05:52PM (#37861918)
    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.
  • by DragonWriter ( 970822 ) on Thursday October 27, 2011 @06:01PM (#37862030)

    Languages that consider whitespace need to die.

    Most languages consider whitespace. In most programming languages where both of the following are valid, they will have different semantics:

    1: foo bar
    2: foobar

    Quite a lot of languages even distinguish between different types of whitespace, e.g., C where the following two constructs are different, despite differing only in which particular kind of whitespace:

    1:
    foo(); //
    bar();

    2:
    foo(); // bar();

    Python may be unusual in which differences in whitespace it considers significant, but not in that it considers whitespace significant. People need to stop confusing the issue.

  • by eriks ( 31863 ) on Thursday October 27, 2011 @06:17PM (#37862210)

    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.

  • by shutdown -p now ( 807394 ) on Thursday October 27, 2011 @07:51PM (#37863004) Journal

    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.

  • by Required Snark ( 1702878 ) on Friday October 28, 2011 @01:46AM (#37865278)
    You are dangerous, incompetent and unprofessional. I sincerely hope that you never work on any system that could even remotely threaten anyone's well being, either physical, mental or economic. There is no such thing as self documenting code. That idea was disproved with COBOL. You have no idea what you are talking about.

    Despite some of the ill founded comments in this discussion, natural language is not comparable to computer language. Programming is closer to mathematics then human language. In the same way that mathematical expressions are always combined with text, code requires comments. No one expects to understand mathematics by just looking at equations, and no one should expect to understand code without comments.

    Human language is reflexive in a way that software is not. This means that understanding software requires information that cannot be expressed in code statements. In order to be comprehensible, particularly when multiple people are involved, comments are a necessity. If you don't understand this you should really be in another line of work.

If you have a procedure with 10 parameters, you probably missed some.

Working...