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

165 comments

  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 Anonymous Coward · · Score: 0

      Programming games for consoles is a key place where this kind of programming knowledge IS required.

      It may not be important for your average Indy title, but for AAA games, it's essential.

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

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

      /Oblg.

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

    6. 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.
    7. Re:Machine specific by K.+S.+Kyosuke · · Score: 2
      --
      Ezekiel 23:20
    8. 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
    9. Re:Machine specific by Anonymous Coward · · Score: 0

      the attitude of 'RAM is cheap' has done more to create bloat than any other.

      That and the attitude that C++ is the "best" language for serious programming.

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

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

      More about the pitfalls of not managing your hot data.

  2. YES! by Anonymous Coward · · Score: 0

    Take that you neigh-sayers! ;-)

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

      Neigh-sayers?

      What do you have against horses?

    2. 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
  3. 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 Anonymous Coward · · Score: 0

      BTW thanks for the watch. It's 12:20.

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

    4. 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."
    5. Re:And? by Tablizer · · Score: 2

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

  4. 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 Anonymous Coward · · Score: 0

      Let's all switch to COBOL!

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

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

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

    6. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      It can actually make the code MORE readable by being shorter to read, and less un-needed things that distract from what the code actually does (and that often leads to brainless copy-pasting).
      For me a language should just need the minimum code necessary to unambiguously describe what you want to it to do.

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

      Succinct does not equate unreadable.

    8. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      The problem with "readability" is caused by the number of side effects created.

      OOP languages tend to have a LOT of side effects, which means that besides reading the direct code, you have to also read the code for the objects being used... and the side effects from those side effects...

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

    10. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Succinctly stated.

    11. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Functional code is much more readable. You can express very abstract and complex ideas and computations succinctly and clearly - through types and transformations of data.

      It's simply easier to reason about and makes you more efficient.

      Of course, there are cases for which OOP is better, but overall, it's an inferior paradigm.

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

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

    14. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      I'm shocked that Perl is not on their list :-/

    15. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 0

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

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

    17. 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.
    18. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      There is a section in the paper on how they selected the languages. Perl did not make the cut.

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

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

    21. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      I find Java boilerplate considerable less readable than a language like Ruby that allows me to find a style that fits the problem domain. When done right, more succinct means more readable.

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

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

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

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

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

    27. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Hi there. Big bank employee checking in. I used to run the mainframe ops team. You're wrong. Bill is right. It's all about transition costs.

    28. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Spoken like some someone who takes IBM marketing literature as a form of information.

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

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

    31. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Also, don't forget to update all your component declarations after you change your entity declaration if you still use pre 93 style vhdl.
      Or update the name at the end of process declaration when you change the name of the process if you use that style of coding.
      The verboseness of vhdl adds nothing to the clarity of code.
      The required names for things also leads to things like:

      clk_process: process (clk)
      or
      foo_generate: for i in 0 to 3 generate
      foo1: foo port map ...

      And the whole name scoping issue which leads to a name used for one thing not being allowed as a name for a different thing.
      (think name for a process and name for a signal assigned by that process)

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

    33. 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.
    34. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      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.

      You think Java is more reliable than COBOL?

      I remember when I had my first beer.

    35. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      I've been in several large companies over the years and they all used COBOL. Current company..Sikorsky. Primary, run everything application SAP. Code, mostly COBOL with some web interfaces.

    36. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 0

      I wouldn't say "inferior", but it definitely is more of a DSL-became-paradigm. It IS a DSL, nobody seems to get the memo that's all, and actually orthogonal to functional programming. What is actually a different paradigm, is Imperative, in general. But OOP? Who cares! Java zombies or future Python zombies?

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

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

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

    40. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      It's hard to draw conclusions based on that. I bet that has more to do with dynamic vs static typing than anything else. Dynamic typing is idiotic.

    41. 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.
    42. Re: Who cares about succinctness .... by Anonymous Coward · · Score: 0

      In real-life, layers start to resemble wormy swiss cheese very fast, thanks to managers and clients having Urgent Needs. Just get it done with. Technical debt? You're lucky if they're willing to pay the interest...

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

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

    46. 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.
    47. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      yeah banks are such a new fangled business concept i'm sure they wouldn't have any technological legacy issues....

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

      Would be happy to != able to.

      --
      Any insufficiently advanced magic is indistinguishable from technology.
    49. 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
    50. 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."
    51. Re:Who cares about succinctness .... by Anonymous Coward · · Score: 0

      Tarleton State University required 12 hours of cobol

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

    53. 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.
  5. It's a study, but not a serious one by Anonymous Coward · · Score: 0

    Published on arxiv. What a joke.

  6. Bad code by Anonymous Coward · · Score: 0

    From TFA:
    "the average Go program is 18.7 times slower than the average C program"

    Who the fuck wrote this code?!

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

    2. Re: Bad code by Anonymous Coward · · Score: 0

      Looks like someone using strings in go.

  7. 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 Anonymous Coward · · Score: 0

      So, are python developers all overconfident morons?

      With modern type systems any developer that thinks dynamic typing is acceptable is an overconfident moron.

    8. Re:Um, yeah ... by Anonymous Coward · · Score: 0

      That's basically the definition of dynamic typing, looked at from a static implementation. 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. 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.

      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.

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

    10. Re:Um, yeah ... by Anonymous Coward · · Score: 0

      Any complete program's semantics, if limits on input types are included (what makes dynamic "any"-based stick to using "any"s), should be able to have all valid types inferred. A programming language which does not require that by compile-time is dynamic. Knowing that those restrictions exist *in the program* just as much as if it were statically typed (just with a lot less code in many cases, than popular static languages), is part of why programs that run rather well can be and are written in dynamic languages. The semantics of any given code having a restricted range of correct types to function correctly with is what allows such languages to work at all. IoW, not requiring complete type information to be known at compile time makes them dynamic, and those languages, and working implementations, exist. That any given program written in them can have its type information determined before run-time does not nullify, that.

      If we had any popular languages with sufficient expressibility, that were statically typed, we could have it all! Instead, we have research papers and toy languages, for the most part. If I need working runtimes, libraries, debugging tools, etc., I can't make the choice to have it all.

      Functions *are* values, so of course they should be treated as such. TBH, I don't like the way Python does it syntactically, either, whether regular named functions as values, or lambdas, and find it a great way to wrote hard to follow code. But, it does at least do that.

      The 2nd try doesn't work. Why? Because the data is an integer, which is not a type that can be sliced. That's a type related error, because passing it the wrong type didn't, and won't, work. That it returns an exception for lacking a method is perfectly fine: 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.

      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.

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

  8. 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 Anonymous Coward · · Score: 0

      To the test-driven advocates:

      Do your test cases cover every possible object type that can be passed into every single method since the method's interface definitions are not defining the input types (equivalent to void* in C)? Better way to ask: since the method doesn't define the input types (has no compiler enforcing what can be passed in by the callers), does the method actually support every possible type of object-type being passed in or not?

      If the answer is no, then the test-cases suck -- they don't even come close to the most basic syntax checking that is provided by a compiler. The test-driven advocates can claim that they have 99.99% code coverage with their tests, and I can still break any method (of their choosing) by simply passing in a different object-type than what the code assumes.

      Good thing that code written in a scripting languages is easy to patch, because that is what will be happening (expect a lot of patching in the field).

    4. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      you are trading all your compile-time (build breaks) for runtime errors that your users will SEGMENTATION FAULT CORE DUMPED.

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

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

    7. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

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

      No, but I've seen people like that. Everything is based on the modification of some global variables. Possibly, they learned old school BASIC or worked only on really tight embedded systems. I don't know any other excuse for it.

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

    9. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      The same study also says that only 78% of the Java solutions compiled without error. So, WTF -- people are submitting code that doesn't even compile (22% of the Java "solutions"), even when using a language that forces you to use a compiler to generate something executable.

      Just this fact alone, means the study is highly questionable: Is their corpus limited to a bunch of Java-newbies who don't even know how to compile their own code?

    10. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      The test-driven advocates can claim that they have 99.99% code coverage with their tests, and I can still break any method (of their choosing) by simply passing in a different object-type than what the code assumes.

      This is correct, if you call a method with the wrong inputs it is likely to break. This does not mean that the method is broken and that test code coverage on the method is meaningless. In this case it is the invocation that is broken, and the way to catch this is to have the invocation also under test.

      In other words, yes your code can call good code with the wrong arguments in the wrong way and break things, so test your code and test that it doesn't break things.

      This applies equally to statically typed languages as well. The compiler may check that the method is called with the right number of arguments, and with something that is derived from the right type, however it does not check that the inputs are valid in many other ways.

      For example, a method might take an integer as an argument. The compiler has checked that your program that prompts a user for an integer and then calls this method with it only calls this method with an integer. But what if the method uses that argument for division and the user enters 0? The types check out, the compiler didn't complain, and then at run time you get a division by zero error. A test that the system does something reasonable when a user enters a 0 is a good guard against this error happening for real users.

      Since such tests would actually use the system to check that it works the static typing has added very little. With a statically typed language the compile would fail and there would be no tests to run. With a dynamically typed language the tests would run but any type errors would stop them being successful. Both ways end up with failures until the code is right.

      In summary, static type checking only guards against one sort of error. Proper testing guards against that sort of error and many other sorts of error. Since proper testing guards against a super set of errors once you start using it there is no benefit to static typing in terms of confidence that the system works.

    11. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      You don't do it that way. You don't design or write Ruby, or Python, the same way you design or write C, Java, C#, and such. It's a different mindset. Coming from Java and C# at school, I didn't immediately become enlightened and love dynamic languages right away, but a few have grown on me (not all good, either! My doc says the SQL rash is incurable :-(). Your code needs to work by design, and that design is not the modeling objects, but data structures and messages. If you change the behavior of a method, then unless it was broken, you are likely in the middle of making some other very major changes. Big object hierarchies, in your own program, are generally a bad sign.

      You aren't trading for errors your user can see, except as an excuse, because the obvious ones should be self-testing (edge functions check inputs, other functions assume they are good, and of a limited set of used types), or designed away, and type errors should in practice be a rarity (I've never seen one not caught by tests, or not causing a failure during program initialization). Have you truly never seen C or Java programs crash? Happens all the time. The compiler catches a subset of errors that, for cases where the scripting type languages make sense, aren't common, unless you're royally screwing up. You are basically left with logic errors that a compiler won't catch, regardless.

      While Ruby is new, it's hard to argue against Python or Erlang for being able to be used to write some very robust systems in, and without overly much difficulty. One of them happened to be designed to crash instead of catch your errors, and the other was specifically intended to do so by its design, to train you to not make it do that on a regular basis.

      Someone will willingly give up the type checking function of a compiler to not be tied down to the static type system, and write code quicker and easier, that can also be more readable, often to such an extent that a fully featured IDE is an unnecessary burden, rather than a must-have tool. Badly written code is going to be badly written code in any language. But, you're not going to grok it unless you either want to, or get in a situation where you need to, and spend time learning to think differently about the code you are reading and writing. You're also not going to go write a hashing library, driver, or do much arithmetic, with them.

    12. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      Have you looked at any Java lately? It's full of annotations, injections, xml configurations, etc, etc. Even if it compiles there's no way to guarantee anything (except null pointer exceptions).

    13. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      This applies equally to statically typed languages as well. The compiler may check that the method is called with the right number of arguments, and with something that is derived from the right type, however it does not check that the inputs are valid in many other ways.

      Yep, I agree with that, and is why you should also always be checking your input parameters too. With a statically typed language, you don't need to check the type because the language has already guaranteed that when you method is called, the 'type is right'. However, you still need to validate the input parameters for the ranges supported (your divide by zero example should be checking for '0' in the input, especially in C where it results in a seg-fault).

      Granted, if it is a 'private' method (if your language even has any encapsulation support -- does yours? doubt it), you can get away without checking the input types in those methods and only check them in your 'public' interfaces.

      In my experience, what I've seen developers who use these dynamic-typed scripted languages:
      1) they don't define input types, even if the language supports it (Groovy 'defs' as an example)
      2) they don't define return types -- read the code yourself if you want to know what the method returns (if anything)
      3) zero documentation, no information about the input parameters / valid ranges, and of course not the types assumed -- read the code to figure out what the developer's assumptions are
      4) always assuming the input is valid: no assertion checks on input (your divide by zero example) -- hell they just assume it is an 'int' without even checking if that is true or not.
      5) no error handling, or if they do, it is of the "catch(Throwable)" variety instead of catching explicit exceptions that they can handle
      6) no encapsulation: no 'private' methods, everything is static, no OO, and a ton of copy-paste code
      7) no automated tests, you are lucky if they even ran the code once before delivery

      I could go on and on. If someone were to try to get away with those sloppy programming practices in a C/Java shop, they'd be canned -- but this is considered the "best practices" when writing code in a scripting language.

    14. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

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

      No, but I've seen people like that.

      They'd make great script-coders. I think the skill bar has been lowered so low, that you have people who have no clue how a computer functions, now writing a lot of the world's code. When something breaks, they are surprised -- myself, am amazed that their code can even function at all.

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

    16. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      A good programmer leverages the compiler to its fullest potential. It is beyond just static-typing. You should write code in such a way so that bugs become compile-time errors instead of run-time errors. For example, the classic problem of missing a "break" statement that causes an unintended switch fall-through can be guarded against by defining the result as 'final', and having the compiler itself catch find the bug.

      Below is a modified version of Oracle's "switch statement" (Java) example to highlight the technique. By making "monthString" final, and also dropping one of the "break;" statements: it turns a logic error (the missing break) into a compile-time error (final variable already assigned).

      Does python support the 'final' keyword? Nope. Hell, it doesn't even support switch/case, 'private' (encapsulation), enums, constants, 'synchronized', etc. These are all features of the (Java) language, enforced by the compiler, to reduce errors in code. Seeing as how python doesn't have these concepts baked in (I've seen people's hacks to try to emulate these concepts), then I conclude that Python. Just. Sucks.

      Have fun writing the Unit-tests to check each of the values for your scripts -- you are going to have to double-implement everything and then your "test" is that both the implementations return the same results.

      public class Test {
              public static void main(String[] args) {

                      int month = 8;
                      final String monthString;
                      switch (month) {
                              case 1: monthString = "January"; break;
                              case 2: monthString = "February"; break;
                              case 3: monthString = "March"; break;
                              case 4: monthString = "April"; break;
                              case 5: monthString = "May"; break;
                              case 6: monthString = "June"; // break;
                              case 7: monthString = "July"; break;
                              case 8: monthString = "August"; break;
                              case 9: monthString = "September"; break;
                              case 10: monthString = "October"; break;
                              case 11: monthString = "November"; break;
                              case 12: monthString = "December"; break;
                              default: monthString = "Invalid month"; break;
                      }
                      System.out.println(monthString);
              }
      }

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

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

    19. Re:Compiled Strongly-typed Languages -vs- Scripts by Anonymous Coward · · Score: 0

      Python is what we have here, used by the article linked (I am the above poster). On the charge of Python sucking, you will find no defense from me. It is easy to learn, and makes for nice succinct simple programs, but gets harder to use, especially dealing with code from others, as the problem complexity grows. It's done, but I wouldn't choose it for much more than overgrown shell scripts (the last thing I used Python for out of preference was an installer).

      In Erlang, for example, the equivalent of your code would not return a result, but fail, due to MonthString having already been bound.

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

  9. Lines of Code?! by Anonymous Coward · · Score: 0

    They measure succinctness by LINES OF CODE.

    That means a line of code that is 80 characters line is more succinct than 3 lines of 5 characters each.

    If I wrote a C program using one line and lots of ;s, it would be the most concise program possible. Poor python, where newlines have syntactic effect!

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

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

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

    3. Re:Lines of Code?! by Anonymous Coward · · Score: 0

      Sure -- except that requires writing for the standard.

      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.

      Lines of code measures how often a programmer presses enter, not how succinct code is. Some languages encourage more enters, some do not.

      If you want to measure succinctness, try counting non-whitespace characters. (barring some extreme corner case languages, whitespace is pretty much equally optional in all programming languages). Now we aren't measuring formatting, but actual differences in how much code you have to write.

      If one language requires 10 characters on 8 lines, and another 80 characters on one line, they get the same measure.

      And languages that UseReallyLongTypeNames::ThatYouHaveToMention( WithLotsOfArguments::ThatAlsoAreReallyLong, NoKiddingThisIsLong:YesItIs() ) don't show up as succinct.

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

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

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

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

  12. 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 Anonymous Coward · · Score: 0

      Actually if you want the kind of performance Fortran was used for before, C++ is the language you want to use.

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

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

    8. Re:C++ = Clear Language Choice. by Anonymous Coward · · Score: 0

      The issue may be that C/C++ insists on doing all floating point computations as double. That may not be much of an issue with today's CPUs, but decades ago I found that an FFT I coded in BASIC was about twice as fast as when I coded it in C. The BASIC version used single precision variables and computations. I'm pretty sure that was on a PC without a math co-processor.

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

    10. Re:C++ = Clear Language Choice. by Anonymous Coward · · Score: 0

      If only C/C++ gave you the choice of using float instead of double.

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

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

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

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

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

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

  14. 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 Anonymous Coward · · Score: 0

      For example, if you send a string to x in the 2nd function def above, it (the runtime) would attempt to parse and convert it to an integer.

      Screw that -- make the caller responsible for passing in what the method declares in its interface. Otherwise, you 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. The compiler should also enforce that the caller must catch/handle said NumberFormatException (or his code declares the he throws that exception as well).

      Without these protections, you are just forcing your users become programmers and 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).

    2. Re:Dual Typing? by Anonymous Coward · · Score: 0

      First, you are confusing strong typing and static typing. What you are referring to is static vs. dynamic typing, not strong vs. weak.

      Secondly, the difference between function foo(x, y)... versus function foo(x:int, y:string)... has nothing to do with static vs dynamic. ML, for example, allows foo(x, y). It uses type inference to determine the types based on how they are used. Types are only specified when they cannot be inferred. Functions which don't do anything type specific are automatically generic. ML is statically typed and has one of the strongest type systems around, but you almost never specify the type of something.

      It's similar to the "var" keyword in c#. It's still statically typed, it just infers the type and saves typing.

      The .Net CLR includes a Dyanmic type in the various languages now which allow you to have dynamic when you want it. Sounds like what you want.

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

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

      ;)

    5. Re:Dual Typing? by Anonymous Coward · · Score: 0

      Or, better yet, don't pass it a string! The fault there is not at the caller, but wherever the data coming *should have been* properly sanitized, *but wasn't*. A string should never be able to reach said function, and you, as a programmer, are responsible for making that true. You shouldn't need to rely on the compiler for that. One of the main things you have to do with a dynamic languages is to be downright *paranoid* about your data inputs from outside the system. Take care of that, and the rest goes smoothly.

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

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

    8. Re:Dual Typing? by Anonymous Coward · · Score: 0

      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.

      Best practices in a scripting language is that no types are defined in method signatures. I'm not sure how an IDE could ever figure out the type from an analysis. No, you are left with reverse-engineering and seeing a LOC of code like "x.subSequence(...)", and then you realize that 'x' must be a CharSequence (or something that extends CharSequence). Lazy developers don't define their types so you have no encapsulation and have to read and understand every line of code of the method you are calling, to ensure you understands all of THEIR assumptions (no compiler is enforcing their assumptions).

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

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

    11. 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]'.

    12. 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;
      }

    13. Re: Dual Typing? by Anonymous Coward · · Score: 0

      Nail on the head. Eventually, at some point, the type of the object is assumed, and if the type is not right: runtime error. Better to just save everyone a lot of headache and declare the types up front. If the function truly could care less about the type, then fine, use void*/Object in those special cases only.

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

  15. Give me succinct code accompanied by COMMENTS by Anonymous Coward · · Score: 0

    You know what's easier to read than verbose boilerplate code that scrolls forever? A single comment explaining the succinct version of that code.

  16. Finding patterns in randomness by Anonymous Coward · · Score: 0

    Another example of looking at something random and subjective, and finding stuff. What does it mean? Is C fast when you're paying programmers to write another linked list? Are functional languages concise when they're inscrutable? Are scripting languages scripts when their interpreter builds a modern fully parsed code representation internally? La la la - tomorrow we'll talk about popular programming languages based on Internet articles.

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

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

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

  20. Re:"Scripting" langs are functional, OO, procedura by Anonymous Coward · · Score: 0

    Another confusion is that strong typing doesn't necessarily imply a compiled or intepreted language, either.

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

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

  23. What a surprise by Anonymous Coward · · Score: 0

    In other news: sky is blue, water is wet, fire is hot.

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

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

  27. On the Other Hand by Anonymous Coward · · Score: 0

    JavaScript's ability to mathematically combine integers with floating point numbers saves a lot of program complexity required to keep 'Types' separate.