Slashdot Mirror


Rosetta Code Study Weighs In On the Programming Language Debate

An anonymous reader writes: Rosetta Code is a popular resource for programming language enthusiasts to learn from each other, thanks to its vast collection of idiomatic solutions to clearly defined tasks in many different programming languages. The Rosetta Code wiki is now linking to a new study that compares programming language features based on the programs available in Rosetta Code. The study targets the languages C, C#, F#, Go, Haskell, Java, Python, and Ruby on features such as succinctness and performance. It reveals, among other things, that: "functional and scripting languages are more concise than procedural and object-oriented languages; C is hard to beat when it comes to raw speed on large inputs, but performance differences over inputs of moderate size are less pronounced; compiled strongly-typed languages, where more defects can be caught at compile time, are less prone to runtime failures than interpreted or weakly-typed languages."

108 of 165 comments (clear)

  1. Machine specific by Anonymous Coward · · Score: 1

    If you are characterizing performance of "large inputs" without quantifying machine behaviors (cache, TLB, ram) you're doing it wrong.

    1. Re:Machine specific by i+kan+reed · · Score: 3, Interesting

      Pragmatically, almost no one actually codes software with that aspect of the target platform in mind. Unless you're writing drivers, OSes or something else that might need to know EXACTLY how many cycles an op is going to take, your cache behavior, e.g. is never going to be part of what you're building your code around.

      And RAM sizes are large enough that a "large" input is easily contained entirely within even smallish RAM.

      As long as they used a consistent testbed between languages, it's an excellent heuristic for language effects on performance in the real world.

    2. Re:Machine specific by Penguinisto · · Score: 2

      And RAM sizes are large enough that a "large" input is easily contained entirely within even smallish RAM.

      /old-man mode: ...and this is EXACTLY what's wrong with programmers today! No eye for efficiency! :old-man mode/

      Cue endless round of arguments about how so-and-so wrote an app that only used one bit of RAM to execute four jobs, yeah - but in all seriousness, the attitude of 'RAM is cheap' has done more to create bloat than any other.

      --
      Quo usque tandem abutere, Nimbus, patientia nostra?
    3. Re:Machine specific by chuckugly · · Score: 2

      And a cache miss costs ~200 clock cycles.

      Size isn't the only thing, locality of reference is just as big or bigger and languages like C/C++ allow a programmer to think about and control such things. With everything being powered by batteries now being efficient isn't something we want to always just throw more hardware at, although such a phone might be more resistant to bending.

    4. Re:Machine specific by UnknownSoldier · · Score: 1

      /Oblg.

      Tony Albrecht's excellent Pitfalls of object orientated programing presentation.

    5. Re:Machine specific by Dadoo · · Score: 1

      and this is EXACTLY what's wrong with programmers today!

      I'd love to agree with you, there, but when I got started programming, VAXen were all the rage, and programmers were still taught to program as if CPU and memory were unlimited resources. Sorry, but this is one philosophy you can't blame on "programmers today."

      --
      Sit, Ubuntu, sit. Good dog.
    6. Re:Machine specific by K.+S.+Kyosuke · · Score: 2
      --
      Ezekiel 23:20
    7. Re:Machine specific by K.+S.+Kyosuke · · Score: 2

      That's not about pitfalls of OOP, that's about pitfalls of OOP in C++ :-p

      --
      Ezekiel 23:20
    8. Re:Machine specific by mjwalshe · · Score: 1

      try looking at some of the work loads that hadoop et al deal with individual file scan be in excess of the largest disk size avaible

    9. Re:Machine specific by chuckugly · · Score: 1

      More about the pitfalls of not managing your hot data.

  2. And? by blueshift_1 · · Score: 2

    So it's telling us just what we already knew? Interesting.

    1. Re:And? by jd · · Score: 5, Funny

      That's the job of consultants.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    2. Re:And? by gnupun · · Score: 1

      So it's telling us just what we already knew? Interesting.

      Really? I didn't know until now that Ruby was slightly faster than Java or that Python is only slightly slower than C#. This is referring to the graph in the "Which programming languages have the best runtime performance?" Crap study.

    3. Re:And? by steelfood · · Score: 1

      This is not funny! This is sad. And all too true.

      --
      "If a nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be."
    4. Re:And? by Tablizer · · Score: 2

      Sometimes advice carries more weight to the listener if they paid and arm and a leg for it.

  3. Who cares about succinctness .... by Squidlips · · Score: 5, Informative

    especially if it makes the code unreadable. Give me the verbose, easy to read code any time. If you really, really want succinctness, use Perl or even better, APL and don't worry about the next poor slob who has to maintain your code.

    1. Re:Who cares about succinctness .... by beelsebob · · Score: 2, Informative

      The problem is that OOP languages rarely have more readable code. Instead, they typically have simply code with more boiler plate.

    2. Re:Who cares about succinctness .... by Theovon · · Score: 2

      Verilog vs. VHDL. I find that the verboseness of VHDL (which requires like 3 times as much typing) actually impedes readability. Sure, there are situations where VHDL can catch a bug at synthesis time that Verilog can't, but the rest of the time, it just makes VHDL unwieldy.

    3. Re:Who cares about succinctness .... by CRCulver · · Score: 2

      Succinctness can supposedly have performance implications in some contexts. I had been away from Python for over a decade before I recently picked up the newest edition of O'Reilly's Learning Python . I was surprised at how many instructions that developers previously spread out over multiple lines are now packed into highly idiomatic one-liners. The author, Mark Lutz, claims in several cases that the Python interpreter is likely to run the one-liner faster (even after it's all been compiled to bytecode) than the traditional multi-line expression.

      Of course, Python's succintness is not Perl's succintness, but it can take people a long time to get up to speed with what now seems the expected idiom, and there's plenty of room for producing something that other eyes will find baffling.

    4. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 1

      I think, perhaps, there might be a difference between syntactic succinctness and semantic succinctness.

      Perl and APL let you express a lot of operations in a few characters. Syntactically succinct, hard to read.

      A lot of functional languages give you (or give you the ability to write) more powerful operators, so that fewer operations are required to accomplish a task. Semantic succinctness: easy to read, if you know what the operators do (and they aren't buggy or inconsistent).

      I'm just pulling this out of my ass, though. I have no idea how you'd go about measuring syntactic vs. semantic succinctness, if it's even a thing.

    5. Re:Who cares about succinctness .... by Flammon · · Score: 1

      Succinct does not equate unreadable.

    6. Re:Who cares about succinctness .... by Chris+Mattern · · Score: 2

      Poorly done, cryptic succinctness can indeed make code impenetrable. Yet overdone verbosity can destroy readability just as thoroughly. When the language is naturally succinct, it's easy to ensure that it contains enough context to be readable. When the language is overly verbose, you generally can't slim it back down to readable conciseness.

    7. Re:Who cares about succinctness .... by sberge · · Score: 1

      Anyone who writes code should care about succinctness. For every line of code you write there is a probability that you make a mistake. The bigger your program, the more room for mistakes.

    8. Re:Who cares about succinctness .... by Tanktalus · · Score: 1

      Perl [lets] you express a lot of operations in a few characters. Syntactically succinct, hard to read.

      That really depends on your experience level, like in anything. Reading a wiring diagram is arcane to the uninitiated, but once you know what symbols represent what types of circuit pieces (including resistors, capacitors, diodes, FETs, etc.), they are both syntactically succinct and easy to read because you can tell what goes where at a glance, you don't need to read and parse a lot of text.

      Same thing in Perl. Once you actually learn it, it becomes easier and faster to read than, say, Java, because there's less skipping over of absolute boilerplate. The more I use perl, the less patience I have for trying to find my way through the verbosity that is Java.

    9. Re:Who cares about succinctness .... by ljw1004 · · Score: 1

      You're conflating "succinct" with "terse"...

      F#, Swift and other functional inspired languages let you omit the wordy boilerplate that gets in the way of readability.

      For instance algebraic data types (a.k.a. discriminated unions, or enums in Swift) are less wordy than declaring an inheritance tree like you would in Java/C#, and pattern matching us a shorter more readable way to deconstruct the data than virtual methods.

    10. Re:Who cares about succinctness .... by sycodon · · Score: 3, Interesting

      You jest, but the majority of large, mission critical systems...payroll, point of sale, etc. are in COBOL...

      When it's got to work, work all the time, handle million and millions of records, and can be maintained by college graduates, COBOL is the way to go.

      --
      When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
    11. Re:Who cares about succinctness .... by Tablizer · · Score: 3, Insightful

      Depends on the reader. Anyhow, coding is the art of balancing trade-offs among many factors, but readability by an average programmer (future maintainer) should be among the top priorities. It's best to learn what code style is the easiest for a random programmer to digest.

      Too much abstraction and factoring can sometimes throw readers off, I hate to say. Those who personally enjoy making "symbolically optimized" code don't like to hear that, but one is not coding on an island, but rather in the City of Fungible Cubicles.

    12. Re:Who cares about succinctness .... by ShanghaiBill · · Score: 1

      You jest, but the majority of large, mission critical systems...payroll, point of sale, etc. are in COBOL...

      Not true. There are legacy systems written in COBOL, but no where near the "majority". In business applications, Java is far more common.

      When it's got to work, work all the time, handle million and millions of records, and can be maintained by college graduates, COBOL is the way to go.

      No one uses COBOL for these reasons. COBOL is not particularly reliable, and is not easy to maintain. The reason it is used it because the decision to use it was made back in the 1950s or 1960s, and now the transition cost is too high to switch to something more sensible.

    13. Re:Who cares about succinctness .... by sycodon · · Score: 2

      So that's a great big Nuh Uh! from you then?

      Perhaps in small business applications you may be right. But the Big Guys...National Banks, large aerospace, etc. COBOL runs the core systems.

      And I'd choose COBOL for reliability and maintainability anytime.

      --
      When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
    14. Re:Who cares about succinctness .... by T.E.D. · · Score: 1

      especially if it makes the code unreadable. Give me the verbose, easy to read code any time.

      Interesting. When I first hit the Internet in the 80's back in the Usenet era, there were lots of folks using this exact argument to promote using platform native assembers over high-level programming languages. I didn't think any of you guys were still around...

    15. Re:Who cares about succinctness .... by Warbothong · · Score: 1

      Give me the verbose, easy to read code any time.

      There are different ways to interpret simplicity and "easy to read", especially local vs. global.

      I've come across this during code reviews, where a few lines of "complex" code (eg. a fold) can replace multiple screens of "simple" code ("doThingA(); doThingB(); doThingC(); .."). Each "simple" line is straightforward and clear, but it's difficult to see the big picture of *what we're trying to achieve*. In contrast, it's obvious what the "complex" solution is trying to do, although it may take a few minutes to work out how each part works.

      Of course it's always a balancing act, but I find the "simple" solutions are the ones which tend to degrade over time: where subsequent modifications forget to update one of the umpteen variables; where alterations are made by copy/pasting the existing version, since it's not clear how the changes will affect whatever algorithm all this stuff happens to implement; where it's easier to leave the broken, unfathomable data processing in place and fix the data afterwards.

    16. Re:Who cares about succinctness .... by rmayes100 · · Score: 1

      I used to think this as well but it is not backed up by the data in the study linked to above (read the actual pdf paper). They compare the number of errors per language and the less succinct languages (C, C#, Java etc) actually have fewer errors than the succinct ones like Python and Ruby. In fact Python, which was the most succinct language, had the lowest percentage (79%) of programs that ran without timeout or errors.

    17. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 1

      Now, onwards to teaching category theory in first grades everywhere!

    18. Re:Who cares about succinctness .... by mrego · · Score: 1

      What really matters is Productivity. If it took 100 hours to get the nice program compiled and working perfectly in a language, verse only 5 hours in another language that would be very significant. Ease of coding, number of errors, and maintainability (i.e. understandability from the readableness of the code) are secondary. Readability obviously is enhanced by the 'meta-code' in other words COMMENTS that could be added to nearly any language. So what language are coders most productive in? (Naturally that depends on the application.)

    19. Re:Who cares about succinctness .... by naasking · · Score: 1

      especially if it makes the code unreadable. Give me the verbose, easy to read code any time

      So I can surmise that you program in Ada?

    20. Re:Who cares about succinctness .... by LQ · · Score: 1

      We don't usually supply a proof of correctness with every program. The program itself must stand as an argument for its own correctness. Sometimes breaking it down into more verbose steps is a way to clarify to future maintainers what your intention was. Also densely packed code is much harder to modify later.

    21. Re:Who cares about succinctness .... by angel'o'sphere · · Score: 1

      Depends on the OO Language I would say:
      o SmallTalk
      o Groovy
      o Simula
      all easy to read and no boilerplate code.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    22. Re: Who cares about succinctness .... by Warbothong · · Score: 2

      You're saying you only write raw pedestrian code with NO layering? I have only ever seen that in CS 101.

      No, the point is that (pure) functional programming forces a separation between "actions", which may affect something in the program (eg. a global), in the computer (eg. a file) or in the outside world (eg. play a sound), from "computations", which can *only* return a value based on the given arguments.

      This separation makes it easy to understand computations: arguments go in, return value comes out and *that's it*. In turn, this makes it safe to work at very high levels of abstraction (Monoids, Monads, Categories, etc.), since we don't care whether some function will be called or not, or what order stuff happens in, or how many times something gets called: the *only* possible thing that can happen is we get a return value.

      Most languages, OOP included, don't make such a separation. An innocent-looking call like "getUserId" may in fact call out to a database, cache files to disk, obtain a lock and send some emails, which are all things we have to keep in mind whenever we try to call that function.

      Actions in functional programming are just as dangerous as things like "getUserId", but they tend to be much smaller. For example, we might write all of a program's logic in a bunch of complicated computations, which ultimately takes a string as an argument and returns another string. We might then have a single, tiny action which reads a string from a file, passes it to our pure computation, then writes the result to stdout.

    23. Re:Who cares about succinctness .... by morgauxo · · Score: 2

      I think it depends more on the coder. Spaghetti code can be written in any language. Good, readable code can be written in almost any language (not sure about Brainfuck). Some languages go farther to force the user to write good code than others but it's still a choice.

    24. Re:Who cares about succinctness .... by jbolden · · Score: 2

      Functional code can't be maintained immediately by the random programmer. They need to learn concepts first. That's also true of languages which are tightly coupled to hardware, languages which are tied tightly to databases or BI tools or languages which uses other conceptual frameworks like logic programming. Everyone learns: do X then do Y when they are a toddler.

    25. Re:Who cares about succinctness .... by angel'o'sphere · · Score: 1

      I guess the parent was more concerned in about languages like Java/C# where you have to "repeat" public/private all over the place at every definition and have to "manually" write getters and setters (if you believe in them)

      But yes: obviously you can write Spaghetti code in every language.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    26. Re:Who cares about succinctness .... by Squidlips · · Score: 1

      I wish! It was a great language, but it was killed for political reasons by the C / C++ Nazi's

    27. Re:Who cares about succinctness .... by jd2112 · · Score: 1

      You jest, but the majority of large, mission critical systems...payroll, point of sale, etc. are in COBOL...

      When it's got to work, work all the time, handle million and millions of records, and can be maintained by college graduates, COBOL is the way to go.

      How many colleges are teaching COBOL these days?
      I doubt that your average Java or C++ jockey CS grad would be able to maintain a business critical COBOL code base.

      --
      Any insufficiently advanced magic is indistinguishable from technology.
    28. Re:Who cares about succinctness .... by Khashishi · · Score: 1

      VHDL has a lot of (useless) metaprogramming. A lot of the standard operators and values are actually defined in header files and stuff. Even things like high and low, if I recall correctly. It's like the designers wanted a language that could describe anything, given the right boilerplates and templates, but didn't care to implement the actual things you need for FPGA programming as built-ins.

    29. Re:Who cares about succinctness .... by Rick+the+Red · · Score: 1

      Given today's job market, I'll bet a lot of CS grads would be happy to maintain a business critical COBOL code base.

      --
      If all this should have a reason, we would be the last to know.
    30. Re:Who cares about succinctness .... by jd2112 · · Score: 1

      Would be happy to != able to.

      --
      Any insufficiently advanced magic is indistinguishable from technology.
    31. Re:Who cares about succinctness .... by steveha · · Score: 2

      I was surprised at how many instructions that developers previously spread out over multiple lines are now packed into highly idiomatic one-liners.

      As with many things, Python one-liners can be good or bad. When done correctly they are awesome.

      Consider this code:

      bad = any(is_bad_word(word) for word in words_in(message))

      If words_in() is a generator that yields up one word at a time from the message, and is_bad_word() is a function that detects profanity or other banned words, then this one-liner checks to see if any word in a message is a bad word.

      I love the any() and all() built-in functions in Python.

      You can take this too far. Instead of defining a function is_bad_word() you could put the code inline as part of the on-liner. And instead of defining a generator that yields up one word at a time, you could add the splitting code to the one-liner. Then you would get:

      bad = any(word in bad_words_list for line in message for word in line.split())

      Or let's say the definition of a bad word is that any substring in the word is from the bad list (thus "frakking" is a bad word if "frak" is in the bad list), with it inline you get:

      bad = any(any(bad_word in word for bad word in bad_words_list) for line in message for word in line.split())

      I think we can all agree that the above is horrible, but I hope you will agree that the first one was pretty nice.

      --
      lf(1): it's like ls(1) but sorts filenames by extension, tersely
    32. Re:Who cares about succinctness .... by phantomfive · · Score: 1

      but readability by an average programmer (future maintainer) should be among the top priorities

      Especially since you rarely lose anything by making your code readable, and often gain flexibility and efficiency.

      --
      "First they came for the slanderers and i said nothing."
    33. Re:Who cares about succinctness .... by morgauxo · · Score: 1

      My point was more than just that you can write spaghetti code in every language. It was also that you can write good code in any language. (except for obvious exceptions that are designed to be difficult.. I didn't want a 'what about Braifuck' reply)

      I think sometimes new languages are being presented a a 'cure' to bad programming. new language constructs and rules are designed to try to force a bad coder to be a good one. As a result we get an endless churning of languages obsoleting old code and making more work for programmers to keep up to date. And yet.. in the end it doesn't even work. Bad programmers still find a way to write bad code. There is no cure for a bad programmer except to realize that they are one and make an effort to learn to do better or just quit.

    34. Re:Who cares about succinctness .... by angel'o'sphere · · Score: 1

      I did not raise the topic 'Brainfuck' if it was not you, it was one of our parents.

      Regarding 'bad programming', there are many ways to program badly.

      I don't really think new languages address that, what do you have in mind there? Imho Onjective-C is an ugly language, and Swift is as successor much less ugly.

      Java and C# are easy languages ... but their strength is the platform/VM, not the language itself. Hence people 'invented' Scala or Groovy etc.

      Bad programmers still find a way to write bad code. Even 'good programmers' who have good concepts still often wrote bad code :) But I get your point, you are very right unfortunately.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  4. Um, yeah ... by gstoddart · · Score: 1

    strongly-typed languages, where more defects can be caught at compile time, are less prone to runtime failures than interpreted or weakly-typed languages

    Isn't that kind of the point?

    Is this supposed to be something we didn't know? Or just confirming something we did?

    --
    Lost at C:>. Found at C.
    1. Re:Um, yeah ... by Anonymous Coward · · Score: 1

      if you've ever talked with a python dev^H^H^Hzealot, you would think it doesn't matter and you must be a bad developer to rely on strong types.

    2. Re:Um, yeah ... by Anonymous Coward · · Score: 1

      if you've ever talked with a python dev^H^H^Hzealot, you would think it doesn't matter and you must be a bad developer to rely on strong types.

      Funny, the first python zealot I ever met was a bad developer who didn't do ANY error checking.

      So, are python developers all overconfident morons?

      Then again, what do you expect from a language which makes whitespace actually part of the syntax.

      I've never been able to look at python as anything other than a lazy man's language since.

    3. Re:Um, yeah ... by Anonymous Coward · · Score: 1

      Neither, because it is incorrect. Python, for example, is a strongly-typed language that will not catch the overwhelming majority of type errors at compile-time.

      Static typing is what can catch type errors at compile time.

    4. Re:Um, yeah ... by MightyYar · · Score: 1

      Python is strongly-typed. It is not statically-typed, however.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    5. Re:Um, yeah ... by Warbothong · · Score: 1

      Python has a single type, which includes integers, bignums, floats, lists, strings, classes, functions, etc. *and errors*. In Python, a run-time error is a value which can be manipulated just like anything else. For example, this code passes errors into functions, adds together a couple of errors and prints some errors out:


      def myFunction(x):
              print "CALLED"
              print x + ' world'

      myFunction('hello')

      try:
              myFunction(100)
      except TypeError as e:
              try:
                      myFunction(e)
              except TypeError as f:
                      try:
                              print e + f
                      except TypeError as g:
                              print "e " + str(len(str(e))) + " f " + str(len(str(f))) + " g " + str(len(str(g)))

      The output is:


      CALLED
      hello world
      CALLED
      CALLED
      e 50 f 67 g 84

      Here "myFunction" accepts an error as an argument (it prints "CALLED" so it must have accepted the argument) and returns an error as its result (using "raise" rather than the usual "return", but that's an orthogonal issue of control flow), hence its argument and return types must include errors. The same is true for "+", "__add__", "str", "__str__" and everything else.

      This means that the "TypeError" naming used in the above code is *only a convention* (just like naming the boolean values "True" and "False" is just a convention; the semantics would be identical if they were called "Chalk" and "Cheese"). In fact "type errors" in the technical sense are impossible in Python, since everything has the same type and therefore there's no alternative but to use the correct type.

      Note that the name "TypeError" makes sense *within* the Python community, since the impossibility of "type errors" makes it clear what we're talking about. However, this breaks down when *comparing* languages, like we're doing here, at which point it makes sense to invoke the technical jargon as a common ground.

    6. Re:Um, yeah ... by Warbothong · · Score: 1

      strongly-typed languages, where more defects can be caught at compile time, are less prone to runtime failures than interpreted or weakly-typed languages

      Isn't that kind of the point?

      Is this supposed to be something we didn't know? Or just confirming something we did?

      Mostly confirmation. It's good to have empirical evidence: https://news.ycombinator.com/i...

    7. Re:Um, yeah ... by Warbothong · · Score: 1

      That's basically the definition of dynamic typing, looked at from a static implementation.

      Exactly: when we're comparing static typing to dynamic typing we have to use some common ground for comparison. That common ground is static typing, since dynamic typing is just a special case ( http://existentialtype.wordpre... )

      The name of a type, and its lineage, while sometimes checked, are usually considered unimportant. Having certain attributes, and methods, of certain types, are important. It allows for similar uses as compositional inheritance, but without actually having that.

      No, that has nothing to do with types. That's just a (rather limited) way of treating functions as values. For example, we can store first-class functions in dictionaries:


      def c1():
          s = {"p": "foo"}
          return {"f": lambda _*: s["p"]}

      def c2():
          s = {"q": "bar"}
          return {"f": lambda _*: "hello " + s["q"] + " world"}

      o1 = c1()
      o2 = c2()

      def show(x):
          print x["f"]()

      show(o1)
      show(o2)

      Here "c1" and "c2" act like class constructors, "s" acts like "self", the "o1" and "o2" dictionaries act like class instances, "p" and "q" act like object properties, the lambdas act like methods and the "show" function is polymorphic. This is pretty much the whole of class-based OO, except for the syntax and that the function dictionary is stored in the __class__ property instead of explicitly in the object. Prototype-based OO is similar except we clone objects and use a __parent__ instead of a __class__.

      Nothing there has anything to do with types. The "implicit self/this argument" is just a run-of-the-mill closure, the "object" itself is just a dictionary of properties, the "class" is just one of those properties which just-so-happens to contain a dictionary of functions with a custom lookup function (which defers to the class "parent" property if a key isn't found). These are all run-time values. The only type involved is "any".

      Personally I prefer to throw away all of the complicated class/instance/inheritance/method mess and just pass functions straight to other functions. Much less messy, and just as polymorphic.

      Code must accept an any, and then fail if the operations it needs to use cannot be applied to type of data of that object.

      But from our common, static point of view it *does not* fail: it produces a perfectly reasonable "exception" value.

      That doesn't make it not strongly typed, just not statically typed. Try getting a substring of a number type, for example. That works in javascript, a very weakly typed language.

      It *also* works in Python:


      def takeTwo(x):
          return x[:2]

      print 'First: ',
      print takeTwo('hello')
      try:
          takeTwo(123)
      except Exception as e:
          print 'Second: ',
          print e


      First: he
      Second: 'int' object has no attribute '__getitem__'

      The first call to "takeTwo" gives back a string "he", which is a perfectly acceptable value of type "any". The second call to "takeTwo" gives back (via "raise") an exception "'int' object has no attribure '__getitem__'", which is another perfectly acceptable value of type "any".

      There is no type-related failure here, in the same way that a "checkResult" function returning "False" isn't a type-related error. The substring operation in Python behaves differently to the one in Javascript, but they both accept any argument and can return any result (they're "endomorphisms"); although the "any" type in Python is slightly different to the "any" type in JS.

    8. Re:Um, yeah ... by Warbothong · · Score: 1

      I won't reply to your rant, since it doesn't seem to have anything to do with the question of "Does Python have type errors?".

      The 2nd try doesn't work.

      Yes it does, it gives me an "Exception" value which I call "e", prints out 'Second: ' and a string derived from "e". Not only does the program carry on executing, but that's the expected behaviour; just like executing code in an "else" branch doesn't mean that an "if" statement "doesn't work", or has a "type error". It's just control flow, which is orthogonal to typing.

      Why? Because the data is an integer, which is not a type that can be sliced.

      No, the data is an integer wrapped up in an "any", so it's type is "any". Values of type "any" must be capable of being sliced, since that's the only type in the language.

      That's a type related error, because passing it the wrong type didn't, and won't, work.

      I assume you mean it's passing *a value of* the wrong type; but it's not. It's passing an "any". It does work, since it gives me the "Exception" value that I wanted and subsequently printed out.

      That it returns an exception for lacking a method is perfectly fine:

      I agree; it's the value I wanted. There has been no error.

      a string is also usable as a list, with each character as an item. The function tries to call a method that any indexed list/array type should have. Those methods existing and working are what defines being of that type, in Python. Any of them not existing or working define it as not of a compatible type.

      You say "in Python", but I *specifically* mentioned that I was using precise, technical terminology as a common ground. That common ground must be static, since dynamic typing is a sub-set of static typing and doesn't have terminology for lots of static stuff (eg. "generalised algebraic datatypes", "cumulative universes", etc.).

      Even if I *did* try to use Python's own definitions for words like "type", they're not actually well-defined. According to Python "type" is a "type", which makes sense:


      >>> type

      Yet "type" is also a function:


      >>> type(123)

      The type of "type" is "type", which is logically inconsistent due to Girard's paradox ( http://ncatlab.org/nlab/show/B... ):


      >>> type(type)

      IoW, that the program fails because it was sent the wrong type is a type-related error. How the implementation handles it does not change that, so long as it does not complete executing and return a value.

      No, the program succeeded. It *did* complete executing: it gave me the "Exception" value I wanted, printed a string, printed the Exception then exited as normal at the end of the script. It wouldn't have to end there of course; I could write more code which would be executed.

  5. Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 5, Insightful

    The difference, as the summary noted, is that when using a scripted-language, you are trading all your compile-time (build breaks) for runtime errors that your users will see.

    If you write 'C' code, would you declare all your input and output return types as 'void*'?
    If you write 'Java' code, would you declare all your input and output return types as 'Object'?

    Why someone would willingly give up the function of a compiler is beyond me. Sure, use scripts for little tasks / prototyping etc. Any long-term project should be using a proper language, that provides type-checking (at compile time), and provides proper encapsulation so that 'private' means 'private' (looking at your Groovy). I don't want to be forced to read every line of your crappy code, just to try to figure out what object-type your method supports because you are too damn lazy to define it in the method's interface.

    When you change the behavior of the method and assume different input/output object-types, I want that to be a BUILD-BREAK instead of me once again having to reverse engineer your code.

    1. Re:Compiled Strongly-typed Languages -vs- Scripts by MightyYar · · Score: 1

      I think the test-driven advocates would say that relying on the compiler is OK for that one particular kind of error, but you really should be writing tests to catch that kind of error along with many others.

      The reality is probably, as you kind of imply, sometimes you have a task that is more suited to one approach or another.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    2. Re:Compiled Strongly-typed Languages -vs- Scripts by subanark · · Score: 1

      Writing tests for 100% code coverage takes a good amount of effort to do. If you don't do this, and use a weakly typed language then you risk not seeing the issue until that rare case that was programmed for is covered.

    3. Re:Compiled Strongly-typed Languages -vs- Scripts by Warbothong · · Score: 1

      Do your test cases cover every possible object type that can be passed into every single method

      I find it quite interesting that dynamically-typed languages, which must rely completely on tests, are the languages worst-suited to testing!

      With a decent type system I can statically *prove* that my code satisfies certain properties, *exhaustively* test it for other properties (eg. those involving small enumerations like the booleans), then fuzz-test whatever's remaining with help from the language ( http://www.reddit.com/r/haskel... ).

      In dynamic languages I get *no* static guarantees (not even syntactic checks, since importing/including files is usually a run-time operation), there's *no* way to test anything exhaustively (everything has an infinite domain; there's no way to guarantee we'll only get booleans) and the language *can't* offer me any help during testing since it has no idea what I'm trying to do.

    4. Re:Compiled Strongly-typed Languages -vs- Scripts by tomhath · · Score: 1
      But look at the results:

      C C# F# Go Haskell Java Python Ruby
      # ran solutions 391 246 215 389 376 297 676 516
      % no error 87% 93% 89% 98% 93% 85% 79% 86%

      Java was one of the poorest at actually running successfully.

    5. Re:Compiled Strongly-typed Languages -vs- Scripts by Warbothong · · Score: 1

      relying on the compiler is OK for that one particular kind of error, but you really should be writing tests to catch that kind of error along with many others.

      Tests *only* make sense if the compiler is trustworthy. If you can't trust the compiler, you can't trust anything it produces, including your tests! Test suites are *far* less trustworthy in comparison, so anything that *can* be handled by the compiler *should* be handled by the compiler.

      Anything that's handled by the compiler doesn't need to be tested, since the tests wouldn't compile!


      -- Our function
      boolAnd :: Bool -> Bool -> Bool
      boolAnd True True = True
      boolAnd _ _ = False

      -- A redundant test
      testBoolAndAcceptsBools :: Bool -> Test
      testBoolAndAcceptsBools b = try (boolAnd b b) Fail Success

      -- An uncompilable test
      testBoolAndDoesNotAcceptInts :: Int -> Test
      testBoolAndDoesNotAcceptInts i = try (boolAnd i i) Success Fail

    6. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 1

      Java was one of the poorest at actually running successfully.

      From the article, the explanation is given:

      Java is unusual in that it has a strong type system and
      is compiled, but is significantly more error prone than Haskell
      and C#, which also are strongly typed and compiled. Our data
      suggests that the root cause for this phenomenon is in Java’s
      choice of checking for the presence of a main method only at
      runtime upon invocation of the virtual machine on a specific
      compiled class. Whereas Haskell and C# programs without
      a main entry point fail to compile into an executable, Java’s
      compile without errors but later trigger a runtime exception.

      Basically any code tested (in Java) that doesn't have a "main()" method (so it can be executed on the command line) is considered a failure. Pretty lame if you ask me -- it is not a "failure", the author of the code is just assuming you can wrapper their library with your own CLI. It proves nothing, other than the paper's authors are incapable of writing their own main() to drive the function on the command-line.

    7. Re:Compiled Strongly-typed Languages -vs- Scripts by ChunderDownunder · · Score: 1

      (I believe he was referring to Haskell.)

      Java's boilerplate isn't a great advertisement for static typing. For a more modern perspective running on a virtual machine, F# and Scala provide OO semantics atop a Hindley-Milner-Damas inspired type inference but with perhaps too much esoteric functionalness for the average mortal!

      One wonders if RoR would have existed if someone had managed to craft a killer web framework on, say, Ocaml a decade ago.

    8. Re:Compiled Strongly-typed Languages -vs- Scripts by Warbothong · · Score: 1

      Have you looked at any Java lately? ... Even if it compiles there's no way to guarantee anything (except null pointer exceptions).

      That's because Java's type system is *unsound*. According to the Curry-Howard correspondence, types are logical statements and values/programs of that type are proofs of that statement. Since Java's "null" is a valid value for any type, it can therefore be used to prove anything, which makes the logic inconsistent, unsound and pretty much useless.

      For any statement (eg. "1 + 1 = 2") we can encode it as a Java type and prove it with null. Then we can negate it (eg. "1 + 1 /= 2"), encode that as a Java type and prove it with null. Hence we can prove "1 + 1 = 2" and "1 + 1 /= 2" at the same time, which is inconsistent.

      Better languages don't have this problem, eg. Coq and Agda.

      I've written a blog post showing how to encode numbers with classes, using Peano arithmetic, although it's in PHP rather than Java: http://chriswarbo.net/posts/20...

    9. Re:Compiled Strongly-typed Languages -vs- Scripts by PJ6 · · Score: 1

      I think the test-driven advocates would say that relying on the compiler is OK for that one particular kind of error, but you really should be writing tests to catch that kind of error along with many others.

      The reality is probably, as you kind of imply, sometimes you have a task that is more suited to one approach or another.

      The nature of testing is that complete coverage grows combinatorially with state. What you're saying is you don't want to eliminate the possibility of an entire class of errors, but rather rest this (rather significant) burden on testing. From my point of view that's like abandoning DRI in a database and saying tests can detect foreign key constraint violations and all the other things DRI can check. While technically true, it just doesn't make any practical sense.

  6. Re:Confirming the obvious. by imatter · · Score: 1

    It is disappointing that this is not the only comment for this post. You didn't even need to waste your time on a body or quoting just a title of Duh!

  7. Re:Bad code by abies · · Score: 1

    Average Go programmers.
    Maybe it tells something about maturity of language (wide knowledge of best practices - or even existence of them), availability of skilled programmers rather than runtime performance.

    And in real world, it might be a lot more important how fast/readable/maintenable code will be written by people you can hire rather than how fast/readable/maintenable it could possibly be in most idealized situation.

  8. "Scripting" langs are functional, OO, procedural by mr_mischief · · Score: 4, Informative

    Simply because a language is billed as a "scripting" language (by which people tend to mean distributed as source code and partially compiled for each execution rather than compiled once and distributed as object code rather than actually used primarily to script other programs) doesn't mean there's no programming paradigm associated with them. They can support procedural, functional, actor-based, object-oriented, logical, dataflow, reactive, late binding, iteration, recursion, concurrency, and whatever other paradigms and methods people want. Some of them support mixing and matching even in the same program.

    Languages that are typically fully compiled can even be run in an interpreter. C-- comes to mind. Often languages known for interpretation (actually most of which are partially compiled rather than interpreted line-by-line) have support for compiling at least portions of a program up front, too. Examples include the .pyc files of Python, luajit, Facebook's HHVM, Steelbank Common Lisp, and Reini Urban's work on perlcc.

    People making claims about one type of language vs. another should really keep straight what types they are talking about.

  9. C++ = Clear Language Choice. by danknight48 · · Score: 1

    It always comes down to personal preference.
    All i care about is performance. If i want performance, i will learn how to use C++, regardless of what new writing methods i need to learn.
    People who cant/dont want to learn a "better language" will always try to brickwall every other language with an excuse that suits their "locked in" writing ability.

    Funny how C++ is missing from this "lets try and justify programming languages using a graph made by a 2 year old with crayons", tests

    1. Re:C++ = Clear Language Choice. by T.E.D. · · Score: 1

      All i care about is performance. If i want performance, i will learn how to use C++,

      Actually, if all you care about is performance, generally Fortran is the language for you. Its when you start caring about something like toolchain support and your own established codebase that C++ starts looking like a much better choice to most folks. But if you "don't care" about those things, here's your compiler.

    2. Re:C++ = Clear Language Choice. by Warbothong · · Score: 1

      The paper justifies their choices, and hence why C++ wasn't included.

      Anyway, if all you care about is performance then why use C++? FORTRAN is faster.

    3. Re:C++ = Clear Language Choice. by Anonymous Coward · · Score: 1

      Seconded.

      C++ (and C) are the only languages I've ever used while working on runtime code for games (and really, C hasn't been the primary language for the past 20 years or so).

      But I've used all sorts of languages for non-runtime code (Python, C# and DOS-Batch being the 3 most commonly used).

      For instance, our GUI tools are mostly written in C# (with some legacy C++ still in use for some older tools). But I prefer python (or sometimes DOS-Batch) for faceless tools (build farm, installers, miscellaneous scripts for users).

    4. Re:C++ = Clear Language Choice. by Art+Challenor · · Score: 1

      Given a project with a deadline, and all projects have deadlines, the performance statement is subjective and depends on the project. Yes C++ will natively run faster (somewhere around 5% faster with current JITs) than Java, C#, scripting, etc. but chasing memory leaks can consume a significant amount of a C/C++ project and that time can be spent optimizing the alorithms/code in other languages.

      For a "Hello World" application, C/C++ win. For a team project involving significant complexity the whole lifecycle, not just the compiled code speed is a consideration.

    5. Re:C++ = Clear Language Choice. by Smerta · · Score: 1

      Sincere question - I've heard that Fortran blows away (or at least beats) C++ for scientific/calculation programming, and considering the 2 languages' history and "raison d'etre", I'm not surprised... but can you lend any insight into what accounts for that, specifically? I mean, if I create arrays or matrices or whatever in C++, and I pay attention to cache effects, etc. it seems like my C++ still can't be as fast when it's compiled down into machine code... I've never seen a good explanation of what's going on under the hood to account for that. Thanks.

    6. Re:C++ = Clear Language Choice. by Warbothong · · Score: 3, Interesting

      Sincere question - I've heard that Fortran blows away (or at least beats) C++ for scientific/calculation programming... can you lend any insight into what accounts for that, specifically?

      http://stackoverflow.com/quest...

    7. Re:C++ = Clear Language Choice. by jbolden · · Score: 1

      Two things.

      1) Fortran has low level mathematical data operators that are more powerful than those in C. I.e. in practice Fortran code compiles to faster code because the programmer is more aware of what will be faster.

      2) ALUs evolved around running fortran code fast the same way modern CPUs evolved around running compiled C code fast.

    8. Re:C++ = Clear Language Choice. by GiganticLyingMouth · · Score: 1

      Fortran doesn't have pointer aliasing. This allows the compiler to perform more aggressive optimizations

    9. Re:C++ = Clear Language Choice. by iggymanz · · Score: 1

      compiled COBOL and Forth also will beat the ass of C/C++

    10. Re:C++ = Clear Language Choice. by iggymanz · · Score: 1

      why, c++ raises the probability of making bugs, spews compiler messages that are hard to read, and to add insult to injury will generate slower code. There is a reason the core libraries of the big math packages are still in Fortran. And after making statement like that someone will post link to some self-touting python / C project, failing to notice it uses huge mass of the same Fortran libraries everyone else uses.

  10. Re:Confirming the obvious. by iggymanz · · Score: 2

    Not obvious at all that C is hard to beat on raw speed on large inputs. Fortran and COBOL and Forth do that.

  11. Re:Lines of Code?! by Anonymous Coward · · Score: 1

    And yet, Python is one of the most succinct languages in the study...

  12. Dual Typing? by Tablizer · · Score: 1

    Why aren't there more languages that allow strong typing were desired but weak typing where not? One can kind of emulate such with generic "variant" or "object" types in some languages, but you have to keep declaring everything "object". If I want dynamic parameters, I shouldn't have to put any type-related keyword in the parameter definition.

    For example, one should be able to type: function foo(x, y)... versus function foo(x:int, y:string)... for weak and strong typing, respectively. And types could be converted as needed for strong parameters rather than require an explicit conversion/casting. For example, if you send a string to x in the 2nd function def above, it would attempt to parse and convert it to an integer.

    Strong typing tends to be best for the "root" routines and deeper infrastructure guts of a system, but weak typing for the top-layer business logic, where being closer to pseudo-code helps one read and fiddle with ever-changing business logic. Dual typing would allow a single language to better fill both roles.

    And one should be able to specify that a given class or module or name-space requires all variable and parameter definitions to be explicitly typed to enforce strong-typing for selected sections.

    The idea that a language must be type-heavy OR type-light seems false; a mere habit of the industry.

    1. Re:Dual Typing? by paddy3118 · · Score: 1

      Strong vs weak typing; static vs dynamic type checking Tablizer's post skids across all four, mangling the differences making it hard to discern their point.

    2. Re:Dual Typing? by Warbothong · · Score: 1

      define a new method that takes as input a String, and declares that it WILL THROW a NumberFormatException (or equivalent) if the String that is passed in is not parseable as a Number.

      Screw that -- make the caller responsible for handling the two possibilities by declaring an `Either` return type in its interface. That way the compiler will enforce that the caller handles both cases.

      Without these protections, you are just forcing your users to become programmers and have to debug your crappy scripts (reverse engineer) what the call stack was (or what Exception they need to handle).

      ;)

    3. Re:Dual Typing? by Tablizer · · Score: 1

      Difference enforcement policies work under different circumstances. While I agree such may make a nice option, I wouldn't want to force it on all methods ever written in the language.

      And I'm against heavy use of exceptions. If one wants to programmatically "catch" a bad number, they can do an "isNumber(x)" test before calling the method. But everybody has a different opinion about such.

      have to debug your crappy scripts (reverse engineer) what the object-types need to be (or what the contents of the String need to be).

      Wouldn't the call signature give that info? Granted, existing IDE's are often crappy at providing such info from dynamic languages, but that's mostly an IDE issue.

    4. Re:Dual Typing? by Tablizer · · Score: 1

      My past attempts to find clear definitions of such produced long angry debates. Often how one views types depends on what mental model they personally use to "run" types in their head. There are many different ways to model the same or very similar type behavior such that selecting a canon model is futile unless we all agree to be arbitrary in order to have a common reference point.

      How a compiler or interpreter is actually written is one modelling approach, but that assumes a language is "defined" by a given implementation at a given point in time rather than externally observable behavior (I/O), and "punishes" clones unfairly.

    5. Re:Dual Typing? by Tablizer · · Score: 1

      I'm not proposing a scripting language, but a dual-typing language so that "types" are optionally required. "Best practices" are to require types on "infrastructure" (lower level) routines, but not the higher-level business-logic routines, at least for custom internal software. Commercial high-customer-volume software may be different.

      The only language I've used in production that comes close is ColdFusion (although it's awkward in other areas).

    6. Re:Dual Typing? by Tablizer · · Score: 1

      If you receive an ID number from a URL parameter and it's already scrubbed to be a "number" in terms of proper digit characters etc., then there is no reason to have to explicitly cast it to "Integer" to pass it a routine that wants a parameter (interpretable as) "Integer". That's eye-real-estate-wasting redundant busy-work.

      Dealing with semi-hidden type-tags is anti-WYSIWYG PITA. A language that gets rid of the distinction between "interpretable as" and "is-a" type has less sneaky surprises. That's my opinion, at least, after comparing and debating the trade-offs. I agree it may sacrifice some run-time efficiency, but it's the job of machines to slave away harder so humans don't have to.

    7. Re:Dual Typing? by Tablizer · · Score: 1

      I don't want it inferred at times: I want to explicit declare my parameter intentions at times so it's "documented" and verified at the entrance to the castle, not deep inside the dungeon somewhere. Sure, the machine can figure that out, but it's not necessarily easy for human readers to figure that out when reading the code.

      The problem with .NET was already described near 'you have to keep declaring everything "object" [to emulate dual typing]'.

    8. Re:Dual Typing? by ChunderDownunder · · Score: 1

      Type inferred languages often allow you to sidestep type inference by explicitly declaring the types using a semicolon following the declaration.

      Microsoft's TypeScript follows that convention when augmenting ecmascript, e.g.

      function add(left: number, right: number): number {
              return left + right;
      }

    9. Re: Dual Typing? by Tablizer · · Score: 1

      You are missing the point of dual typing it seems. If you don't want dual typing, there are already plenty of existing languages that are not dual typed. I'll give up convincing anybody that heavy typing or scripting (light typing) is the best way to go because the choice of those already exists for those who want them in fairly common languages. But give those of us who want dual typing a viable choice if you are in the interpreter implementation business so all 3 camps can be happy. (ColdFusion has it to some extent, but is lacking in other areas.)

  13. Re:Lines of Code?! by Warbothong · · Score: 1

    If I wrote a C program using one line and lots of ;s, it would be the most concise program possible.

    Rosetta Code solutions were chosen precisely because they're idiomatic, and hence not tuned to these benchmarks.

    Poor python, where newlines have syntactic effect!

    There are loads of Python solutions posted on http://codegolf.stackexchange.... which *are* tuned to similar benchmarks.

    It's remarkable how much can be achieved with a single list comprehension.

  14. huh by robi2106 · · Score: 1

    My /. account still works. Havent' used it in ...err... a few years.

    Just here to bump this article for my friend Mike and his fantastic work on RC.

  15. Re:Confirming the obvious. by Ukab+the+Great · · Score: 1

    A study recently found that "Duh" is far more succinct than "You're telling us something we already new", and "No shit sherlock" applies greater annoyance at the repetition of redundant information.

  16. AHK doesn't obey all the script-lang "rules" by CrashNBrn · · Score: 1
    I wouldn't want to make too close of a comparison to scripted-langs and non-scripted, but this part that you reference

    The difference, as the summary noted, is that when using a scripted-language, you are trading all your compile-time (build breaks) for runtime errors that your users will see.

    Is not true for all scripted languages. AutoHotkey for instance gained a #warn flag, that among other things:
    1) Tells you when you have a local variable with the same name as a global. The local trumps the global, unless it's a forced/hard Global, but it lets you know so as to be aware.
    2) Tells you when you reference a variable that hasn't been assigned a value, prior to the reference.
    3) Warn when an environment variable is automatically used in place of an empty script variable.

    AHK is written in C++. Supports normal braces usage {}. Has an interesting take on Objects, as well as things like Regexp Match objects. Can pass functions as variables to functions, ByRef variables, varargs, etc. AHK Can be compiled to an .exe instead of just run-time interpreted.

    Lexikos has done some pretty cool stuff with it since ~2007; AHK2 is shaping up. More info here for anyone interested.

    Note: autohotkey.com has been subverted by a f'ing wanker that wont give up the domain-name and is pushing an agenda. He also only provides a version of AHK that hasn't been updated in 7 years (from 2007).

  17. Mickey mouse tests by Alomex · · Score: 2

    If I understand the statistics correctly the average program has 71 lines of code. Those are mickey mouse tests for which scripting languages shine. All the verbosity of imperative languages becomes handy when you have tasks that are a few 100KLC long.

    This is a lesson Perl learned the hard way: once your program is long enough you beg in your knees for strong static type checking system.

  18. Data from snippets, not real programs. by Animats · · Score: 1

    The problem with programming language evaluations is that they tend to be based on small snippets of code, like this one, or data from novice student programmers, or worse, popularity. Yet what really tends to matter is how much trouble a language causes in large systems and in later years. That's where high costs are incurred because changes in module A affect something way over in module Z. Undetected cross-module bugs, high costs of changing something because too much has to be recompiled, that sort of thing. How much help the language gives you then matters.

    A really good programming language study should digest data from change logs on some major open source projects.

  19. Re: YES! by Anonymous Coward · · Score: 1

    Neigh-sayers?

    What do you have against horses?

  20. Grand Tradeoff [Re:Compiled Strongly-typed Languag by Tablizer · · Score: 2

    In my opinion the basic trade-off is that "scriptish" languages can be written to be closer to pseudo-code and thus easier to read and grok. Strong/heavy typing tends to be verbose and redundant, slowing down reading.

    Better grokkability often means less "conceptual" errors, but at the expense of more "technical" errors, such as type mismatches. There's no free lunch, only trade-offs.

    In some projects the conceptual side overpowers the technical-error side, and vice verse. It also depends on the personality of the coder or team.

  21. For three decades or more. by Ungrounded+Lightning · · Score: 1

    So it's telling us just what we already knew? Interesting.

    For three or more decades. (Before that some of the classes of things they're comparing didn't exist, with enough deployment, to characterize.)

    On the other hand, it's nice to have it confirmed with some rigor and measures.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  22. Re:YES! by TheInternetGuy · · Score: 1

    Take that you neigh-sayers! ;-)

    We are no longer the pgrogrammers that say neigh, we are now the programmers that say Ekki-ekki-ekki-ekki-PTANG. Zoom-Boing, z'nourrwringmm

    --
    If my comment didn't sound as good in your head as it did in mine, then I guess we all know who's to blame
  23. Go Go by Ottibus · · Score: 1

    The biggest suprise for me is how well Go does:

    "Go is the runner-up but still significantly slower with medium effect size: the average Go program is 18.7 times slower than the average C program. Programs in other languages are much slower than Go programs, with medium to large effect size (4.6–13.7 times slower than Go on average)."

    My only objection is that they classify Go as "procedural" along with C, Ada, PL/1 and FORTRAN. It may not have inheritance (a good thing in my book!) but it has many OO features including support for abstraction and encapsulation.

  24. Re:Lines of Code?! by Warbothong · · Score: 1

    You can strip out all C newlines (after removing escaped newlines) and replace them with spaces, except for ones right before a #, and the exactly identical code will score much higher on succinctness.

    Did you do this to a bunch of examples on Rosetta Code before the database dump was taken that this study is based on? No? Then it doesn't matter, because as I said Rosetta Code represents idiomatic solutions.

    Code Golf already takes this into account (counting bytes).

  25. Re:Lines of Code?! by awshidahak · · Score: 1

    Poor python, where newlines have syntactic effect!

    So do semicolons. For example:

    >>> print "this";print "that"
    this
    that
    >>>

    works.