Slashdot Mirror


The Most WTF-y Programming Languages

itwbennett writes "A couple of years ago, developer Sammy Larbi undertook a project to identify which languages had the most instances of the string 'WTF' in their GitHub code repositories. At the time, Objective C topped the list. ITworld's Phil Johnson has updated Larbi's research using GitHub data from the last 21 months, but instead of screen-scraping GitHub search results as Larbi had done, he queried the GitHub Archive for stand-alone instances of 'WTF' in the comments attached to GitHub commits to weed out cases where the string 'WTF' was legitimately used in the code. The three most baffling languages for 2012/13: C++, Lua, and Scala. Objective C comes in at #16."

33 of 254 comments (clear)

  1. Oblig.... by DougOtto · · Score: 5, Funny

    WTF?

    --
    Solving Unix problems since 1989...
  2. One for one by Anonymous Coward · · Score: 3, Interesting

    C++ deserves its spot, it's pretty screwed up. I haven't dealt with Lua or Scala, so I can't comment on either. However, I imagine this probably also scales directly with the popularity of the language and indirectly with the skill of the people writing in it. So Lua would make sense; it's popular and seems to attract a lot of amateurs. I'm surprised PHP is so low, though; I hear horror stories about it that make me glad I never have to touch it.

    1. Re:One for one by Anonymous Coward · · Score: 5, Insightful

      perhaps the people who write PHP code do not realize when they have written a WTF.

      Also, to borrow a troll from theDailyWTF (.com)
      "TRWTF is Visual Basic"

    2. Re:One for one by dgatwood · · Score: 4, Insightful

      PHP is actually a pretty nice language. It's basically just C with dollar signs, classes, and better string and array handling, stuffed into a fairly straightforward HTML template language.

      You hear so many horror stories about PHP because of what I would describe as a "meta problem". Like most languages that are primarily used for web coding, a sizable percentage of people who write code using PHP have no idea what they are doing, as their level of programming skill is only slightly above "can write out basic HTML markup using string manipulation". This results in terrible code with lots of horrifying bugs, poor performance, security holes, and so on. JavaScript, Ruby, etc. are also known to exhibit this phenomenon.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    3. Re:One for one by Nerdfest · · Score: 4, Insightful

      Well, that and the inconsistencies.

    4. Re:One for one by Aelanna · · Score: 4, Informative

      ...and all of the API methods being in a single, global namespace...

    5. Re:One for one by Zero__Kelvin · · Score: 3, Insightful

      Or more accurately, everything written in PHP is one big WTF.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    6. Re:One for one by Anonymous Coward · · Score: 5, Interesting

      There's even a website dedicated to PHP WTFs

      Consider that a language (rather than a programmer) causes a WTF moment when it behaves other than would intuitively be expected according to its own rules of grammar. On that basis alone, PHP wins hands down.

    7. Re: One for one by jd2112 · · Score: 4, Funny

      Everything written in PHP looks like it was written on PCP.

      --
      Any insufficiently advanced magic is indistinguishable from technology.
    8. Re: One for one by datavirtue · · Score: 3, Funny

      Seriously, PHP is the only "language" I can program in while intoxicated. It's actually fun when you have had a few whereas I cannot seem to do anything in other languages when I'm a little tipsy.

      --
      I object to power without constructive purpose. --Spock
    9. Re:One for one by DMUTPeregrine · · Score: 3, Insightful

      Naw, PHP causes a WTF when it behaves as one would intuitively expect it to, according to its own rules of grammar.

      --
      Not a sentence!
    10. Re:One for one by Phroggy · · Score: 4, Informative

      PHP is actually a pretty nice language.

      No it isn't.

      It could have been, if the people who created it had known what the hell they were doing. And it has gotten a lot better in recent years (for example register_globals has actually been removed from the language now), but where they started from was so mind-numbingly stupid that I don't see how they could ever make it actually good, without also breaking it in ways that would make everyone stop using it.

      Here's a general rant about how stunningly awful PHP is: http://www.codinghorror.com/blog/2012/06/the-php-singularity.html

      And here's a specific and detailed side-by-side comparison between PHP and Perl: http://www.tnx.nl/php.html

      But you're spot-on about the "meta problem": most people who write in PHP have no idea what they're doing, so most PHP code out there is badly written, so if you're learning the language, there's a very good chance that you're learning from someone who didn't know what they were doing.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  3. Visual Basic by BenSchuarmer · · Score: 4, Insightful

    I'm not sure whether it's the language, or the people who choose to use it.

  4. Why would seeing 'WTF' implicate the language... by Assmasher · · Score: 5, Insightful

    ...instead of the code itself?

    I've seen plenty of "WTF was this guy thinking when he wrote this?" or "WTF is he trying to do here?" comments in code.

    --
    Loading...
  5. Bad statistics are bad by Anon,+Not+Coward+D · · Score: 4, Insightful

    those conclusions are drawn without controling for a language usage. Since c++ is widely adopted so there will be more instances of a comment where "WTF?" is used.

    Why don't use a percentage at least? Even if that was the case, the problem remains... a wtf-y language may be the most avoided and/or not present in github

    --
    Sometimes it's better not having signature
    1. Re:Bad statistics are bad by kyle3489 · · Score: 5, Informative

      those conclusions are drawn without controling for a language usage. Since c++ is widely adopted so there will be more instances of a comment where "WTF?" is used.

      Why don't use a percentage at least? Even if that was the case, the problem remains... a wtf-y language may be the most avoided and/or not present in github

      Well, they DID account for it, but they did it all wrong. They counted WTFs *per repository* ...but that makes the assumption that all repositories are of equal size, which they are not. If C++ repositories have more code on average, then that simple fact could account for the increased WTFs per repository, even if everything else was equal.

  6. LICENSE.txt by TeknoHog · · Score: 5, Funny

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    Version 2, December 2004

    Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

    Everyone is permitted to copy and distribute verbatim or modified
    copies of this license document, and changing it is allowed as long
    as the name is changed.

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    0. You just DO WHAT THE FUCK YOU WANT TO.

    --
    Escher was the first MC and Giger invented the HR department.
  7. That's easy. by gallondr00nk · · Score: 5, Informative

    Brainfuck. Look it up, I can't even give a code example as it pisses off /.'s filter.

  8. My WTF by EmperorOfCanada · · Score: 3, Interesting

    My WTF would be people posting Visual Basic to GitHub. Then another WTF for anyone posting cobol to Github. My next WTF would be where the WTF is directed. Is it directed at the code or away from the code. Also many might be directed at the language or even a specific implementation. So my regular WTF in Objective-C would be theInsanelyLongDefinedParametersThatAreUsedInTheNS library. But when it comes to much of my own past perl code I suspect I would comment WTF in that in my Perl days I could twist a regular expression into pretty much anything.

    But when you are getting to a lower level as in C and C++ you are going to be running up against strangeness in libraries like OpenGL and might be writing a comment such as "WTF won't nVidia release a proper library for Linux?" Or "WTF is wrong with the Android NDK and getting GPS data in C++?"

  9. WTF by ArcadeMan · · Score: 3, Funny

    Watchdog Timer Fault.

  10. Objective-C by Ukab+the+Great · · Score: 4, Funny

    We Objective-C developers prefer more verbose WTF statements, such as

    - (void)whatTheFuckAreYouDoing:(NSString *)wtf withThatAbsurdAlgorithm:(NSString *)algorithm thatOnlyOnePersonOnDevTeamUnderstands:(BOOL)doesHeReallyUnderstandIt;

  11. Statistics, the mother of all lies... by paavo512 · · Score: 5, Insightful

    According to TFA, he "calculated the average number of WTF commit comments per repository". So why not per line of code or whatever? C++ projects tend to be rather large (because it is harder to write large projects in other languages), so surely by this metric C++ would win (aka lose) here.

    If there is one thing I have learned about statistics it is that you can prove about anything you want ... unless you want and are actually able to find the correct normalizations.

  12. I'm going to find out the best language... by ddd0004 · · Score: 5, Funny

    by using the search term "l33t".

  13. Re:Oh good grief. by beelsebob · · Score: 5, Insightful

    Languages are just Syntax - get over it.

    It makes me sad that so many people focus on the syntax of the language they're using. So much so, that they think that languages are just syntax.

  14. Re:C++ by geek · · Score: 5, Insightful

    IMHO, C++ is a simple, flexible, intuitive, and powerful language... IF (and only if) you know how to use it.

    So what you're saying is that it actually isn't simple, flexible and intuitive? Because if it was simple, flexible and intutive you wouldn't have to say "IF (and only if) you know how to use it." That's kind of a big contradiction.

  15. They forgot SQL! by Zero__Kelvin · · Score: 4, Insightful

    WTF?

    SELECT repository_language, count(*) AS wtf_cnt
    FROM [githubarchive:github.timeline]
    WHERE type == "PushEvent" AND
    REGEXP_MATCH(LOWER(payload_commit_msg), r'wtf[^a-zA-Z0-9]')
    AND PARSE_UTC_USEC(repository_created_at) >= PARSE_UTC_USEC('2012-01-01 00:00:00')
    AND PARSE_UTC_USEC(repository_created_at) GROUP BY repository_language
    ORDER BY wtf_cnt DESC
    LIMIT 100

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  16. Re:I guess they do not have much LISP code? by Darinbob · · Score: 3, Funny

    (W (T (F)))

  17. Re:Why would seeing 'WTF' implicate the language.. by QRDeNameland · · Score: 3, Insightful

    Why would seeing 'WTF' implicate the language...instead of the code itself?

    Well, my nominee for the language that enforces a "WTF" syntax is DOS/Windows batch/command language (so WTF it doesn't even have an official name). There's been more than a few times I had to google to figure out how to script some seemingly simple functionality and upon finding the answer said "Really?!?! WTF?!?" It is pretty much impossible to make more-than-trivial batch scripts readable to someone not well versed in the black art of .bat, at least not without a boat load of rem statements.

    --
    Momentarily, the need for the construction of new light will no longer exist.
  18. Re:Oh good grief. by ShanghaiBill · · Score: 4, Funny

    Languages are irrelevant.

    01010111 01010010 01001111 01001110 01000111 00100001

  19. Re:C++ by Dodgy+G33za · · Score: 3, Insightful

    You need to go and look up the meaning of the word intuitive.

  20. Re:Oh good grief. by Anonymous Coward · · Score: 5, Funny

    and even WHOSE

  21. Re:C++ by jma05 · · Score: 4, Insightful

    > IMHO, C++ is a simple, flexible, intuitive, and powerful language

    > simple

    By exactly what standards is C++ a simple language? Other than Perl, can you name several more complicated languages than C++?

    > flexible

    Fine. It is.

    > intuitive

    How is C++ intuitive? There are plenty of articles explaining the gotchas of C++. Have you read them?

    > powerful

    The most abused adjective in reference to programming languages. I don't think I have seen *any* general purpose programming language that has not described as powerful.

    C++ is powerful. Python is powerful etc. Just not in the same way.

    > The problem is, most programmers don't.

    So it isn't simple or intuitive. It's the programmer syndrome. Of course my UI/API is simple and intuitive... because I get it. The only way others would not get it is because they are stupid.

    > So often, I end up working on spaghetti code written 5 years ago by someone who, for example, thinks inheritance is the solution to all problems, and that private member variables are for sissies.

    This is different - perhaps needlessly complex use of C++. So these programmers don't get OOP or good design patterns. That's not what people complain about when they talk about C++ being complicated though.

    For the record, I don't hate C++. I like what it has done with C++ 11. But simple and intuitive are the farthest things from it.

  22. Re:Oh good grief. by Xest · · Score: 4, Insightful

    Through my career I've noticed this sort of belief come and go.

    At first, when I learnt my first language, I was impressed by people who knew multiple languages.

    Then I learnt my second language and thought hey, languages are just syntax, and I learnt a few more languages.

    But I wasn't really learning the languages per-se, I was simply learning some basics of each language - if-else, for, while, that sort of thing.

    It turns out there's more to most languages than this, so then I learnt about C#'s advanced language features and how they're implemented like LINQ, lambda expressions, extension methods, and so forth.

    But then I found other languages were also implementing or already had implemented similar things like lambdas in C++11, and that in some ways it was just syntax again.

    Eventually I realised that some of it is just syntax, but more fundamentally it's about understanding certain theory and principles of maths and computer science that are prevalent throughout languages and software and that come up in various guises and ways and it's understanding that that allows truly great developers to hope languages successfully, coupled with knowing the quirks and pitfalls of each and every language. That every now and then you'll encounter a language that follows a completely different paradigm and that what you thought you knew to be correct across all languages or all languages of a certain type/class/paradigm isn't necessarily so.

    If you're say, a Java or C# developer and you end up on a PHP project then it's not enough to just know how to write those basic and common programming constructs, you have to know that PHP has contradictory equality operators and so forth to be able to write good software in it.

    Don't feel too sad for the GP, he's just not very far along in this path of realisation. If he's the sort of developer that is good at self-improving he'll get there eventually. More than anything the idea that's it's "just syntax" that makes you sad, is simple inexperience and, everyone's inexperienced at some point. The real test of competence and worth is whether they choose to stay inexperienced or not.