The Most WTF-y Programming Languages 254
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."
Oblig.... (Score:5, Funny)
Re: (Score:2)
The WTF metric : http://http//www.osnews.com/images/comics/wtfm.jpg: [http]
Re: (Score:2)
The WTF metric : http://www.osnews.com/images/comics/wtfm.jpg [osnews.com]
Re: (Score:2)
WTF?
Well, that's fine.
Re: (Score:3)
Or as I like to spell it "APL" (the most WTF-y language EVER!)
APL? APL is actually a fine language. The actual WTF Award belongs to such languages as BANCStar [wikipedia.org] and the like.
One for one (Score:3, Interesting)
Re:One for one (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"
Re:One for one (Score:4, Insightful)
Re:One for one (Score:5, Interesting)
There's even a website dedicated to PHP WTFs [phpwtf.org]
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.
Re:One for one (Score:4, Insightful)
Re: One for one (Score:5, Funny)
Comment removed (Score:4, Funny)
Re: (Score:2)
Symfony2's code is beautiful.
Oh good grief. (Score:2, Informative)
All of us develop according to the platform. In other words, you want to make a living coding apps, code in Objective -C, C# or Java.
What's the issue here?!
I mean if I had to make a living coding COBOL, I'd do it!
Languages are irrelevant. You want to develop iOS apps - Objective-C. MS apps? Well, you get a break here C# (Java Clone), VB, C++, C, etc ...
Android - C++ and they push you to Java.
Languages are just Syntax - get over it.
Stuck on a language because it's the "best" tool? You are a hack. A compu
Re:Oh good grief. (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.
Re:Oh good grief. (Score:5, 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.
Re: (Score:2, Insightful)
Re:Oh good grief. (Score:5, Funny)
and even WHOSE
Re: (Score:3)
Re:Oh good grief. (Score:5, Funny)
Languages are irrelevant.
01010111 01010010 01001111 01001110 01000111 00100001
Re: (Score:2)
Re: (Score:2)
All of us develop according to the platform. In other words, you want to make a living coding apps, code in Objective -C, C# or Java.
There's still plenty of work targeting multiple platforms in plain old C, it's been putting the cake on my table for the last couple of decades. Having said that, most (paid) developers can do "something" in most languages simply by reading some code and googling unfamiliar constructs. I suppose when you think about it, googling an unfamiliar language is just a more relaxed version of WTF. Also, in my experience most WTF comments within the code are criticisms of the author, rather than the language itself.
Re: (Score:2)
Actually once you remove the compiler (which commonly contains the parser as well ) all is left is ASCII, your point being?
Re:One for one (Score:5, 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.
Re:One for one (Score:5, Insightful)
Well, that and the inconsistencies.
Re:One for one (Score:4, Informative)
Re: (Score:3)
Re: (Score:2)
A significant percentage of those are leaky abstractions from the underlying C library routines, thus furthering my assertion that PHP is basically C with dollar signs.
And so on. Besides, if you haven't ripped out all your escaping code and replaced it with parameterized queries by now, chances are you've been compromised more than once already.
Re: (Score:2)
PHP is actually a lot like Perl. It also makes sense because PHP was originally a template language for Perl prior to getting rewritten in C.
The problem with PHP is the inconsistency. Parameter order is not consistent. Point releases change behavior and break code.
I also find PHP to be more irritating to debug than other web languages.
Re: (Score:2)
PHP is not C with dollar signs. Syntax alone doesn't make a language. Behaviour does. C is very small, PHP is huge. C the language is small and separated from the standard libraries. PHP and it's libraries are the language. C's closeness to bare metal matters, function, references, allocating and freeing memory. no dictionaries. having to build any complex data structure from the ground up, not the same or related. When I program in C or PHP, my mind mode is not the same in any way shape or for
Re:One for one (Score:5, 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 [codinghorror.com]
And here's a specific and detailed side-by-side comparison between PHP and Perl: http://www.tnx.nl/php.html [www.tnx.nl]
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.
Re: (Score:2)
Let me restate that. Syntactically, PHP is very, very close to C with dollar signs. The syntax of its class implementation is somewhat different from that of C++, but given that pure C has no notion of classes whatsoever, this cannot reasonably be called a difference between C and PHP except inasmuch as such a syntax exists at all.
Re: (Score:2)
By removing the rest of that sentence, you completely changed the meaning of what I said. C is a walking disaster, but PHP's non-pointer-based string/array handling removes the sharp edges that make C a walking disaster.
Re: (Score:2)
It works really well for generating certain types of web pages, such as forms, tables, etc.
You mean like PHP's heredoc syntax?
echo <<<EOT
<p>Blah blah blah</p>
EOT;
Re: (Score:2)
Re: (Score:2)
I guess they do not have much LISP code? (Score:2)
Re:I guess they do not have much LISP code? (Score:4, Funny)
(W (T (F)))
Re: (Score:3)
People get forced to write in C++ or Java, people are rarely forced to write lisp, so when they write lisp codes, they enjoy it hence rarely do you hear WTF and oh, everyone rolls out their own library.
Re: (Score:2)
Visual Basic (Score:5, Insightful)
Re: (Score:2, Funny)
Its way, way, the people who use it. For some of our in house code, I've seen for a variable:
Select Case x
case 1
goto line1
end select
Select Case x
case 2
goto line2
end select
Line1:
bblah blah
goto line3
line2:
blah blah
goto line3
line3:
rest of program
Re: (Score:3)
Haha. That was almost exactly how the original "Adventure" game was implemented, in FORTRAN. And I saw many, many BASIC programs that worked the same way back then.
For the unenlightened, Adventure was the first of the 'cave' games that I know of (although "Hunt the Wumpus", written in Dartmouth BASIC and also running on many timesharing systems, might have had an independent birth). Output was to a text terminal, much like the original Star Trek game.
Adventure was written as one very large linear program
Re: (Score:2)
What is a better data structure for command parsing?
Re: (Score:2)
It's the language. I use it it but not through choice, and all I can say is WTF.
Why would seeing 'WTF' implicate the language... (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.
Re: (Score:2)
C/C++ does allow for a lot of that.
Reading IOCCC entries illustrates this perfectly.
Re: (Score:3)
C++ is full of constructs that while good code and properly used, still leave the reader thinking WTF? There's just a lot of language that most people have no reason to use, and so can be baffling when first encountered. Things like overloading "new" and "placement new" make perfect sense when you have the problem they were intended to solve, but otherwise just inspire "what is this I don't even!"
Good C code tends to make sense even if you don't know C.
Re: (Score:2)
Re: (Score:2)
Re:Why would seeing 'WTF' implicate the language.. (Score:4, 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.
Re: (Score:2)
I agree. Just because some code was commented on by William T Foster doesn't mean the code or the language is bad.
WTF!?!?!? (Score:2)
Where are some examples of these offending comments? With no context this list of languages is meaningless.
Bad statistics are bad (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
Re:Bad statistics are bad (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.
LICENSE.txt (Score:5, Funny)
What's wrong with Lua? (Score:2)
Is there any indication why Lua scores so highly here? It seems a rather benign little language to me. Certainly, nil-terminated arrays are can be tricky, and a missing local keyword can ruin your day, but that seem minor annoyances. And for the local-vs-global issue, there are now editors with semantics highlighting that clearly disambiguate the two cases.
Re: (Score:2)
I do like to see some of those lua codes too, i'm a bit shocked at that.
Re: (Score:3)
There is a C-to-LUA compiler. I'm sure its output is fun.
Re: (Score:2)
Well, I would consider that an assembly language not lua code. It's kinda like the languages that compiler to javascript. Those codes are not meant to be read or modified by human.
Re: (Score:2)
Oh, you've never had to maintain production assembly language for which the original source code was lost? (Well, we had the code as comments put there by the compiler, but no compiler for the original language was still around). Kids these days have it so easy!
Re: (Score:2)
Discloser: There hasn't been a year that has gone by since ~1987 that I have not written a good amount of assembler code for some processor, and I'm not even a god damned professional programmer.
Re: (Score:2, Informative)
LUA is the scripting language for World of Warcraft.
WoW stores addon data files in the "WTF" folder.
This is more-than-likely due to that.
Re: (Score:2)
Having read Lua language source code, there's not a lot of WTF in there, at least no more than normal.
Re: (Score:2)
If you think PHP is bad, go check the parsing order of ExpressionEngine [loweblog.com].
Re: (Score:2)
That's not the worst part of it, their insane parsing order means that templates are a nightmare to understand. Throwing sequential parsing logic out the window and following that guide is the only way to understand what's going on.
Re: (Score:2)
Sounds like your bias got in the way of developing. I write C# for money. Complaining is fine but you should not only do the work but become great at it. I'd rather write PHP than C#, fyi : )
That's easy. (Score:5, Informative)
My WTF (Score:4, Interesting)
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++?"
WTF (Score:4, Funny)
Watchdog Timer Fault.
Objective-C (Score:5, Funny)
We Objective-C developers prefer more verbose WTF statements, such as
- (void)whatTheFuckAreYouDoing:(NSString *)wtf withThatAbsurdAlgorithm:(NSString *)algorithm thatOnlyOnePersonOnDevTeamUnderstands:(BOOL)doesHeReallyUnderstandIt;
Re: (Score:3)
Statistics, the mother of all lies... (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.
Re: (Score:2)
12 out of 30 Helens agree with your conclusion about statistics.
Re: (Score:2)
That's still a metric that I can't really wrap my head around. Instead, why not choose something more familiar, such as the average number of WTFs per Library of Congress written in that language? Much more useful.
C++ (Score:3, Informative)
The problem is, most programmers don't. 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.
Also, I wonder how many of those "WTF"s were from people trying to use Windows APIs (don't you just love COM?). That's what consistently causes me the most frustration.
Re:C++ (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.
Re: (Score:3)
Re:C++ (Score:4, Insightful)
You need to go and look up the meaning of the word intuitive.
Re: (Score:3)
>> C++ is a flexible, and powerful language
Fixed that for you.
C++'s strengths come at a steep price.
Re:C++ (Score:5, 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.
I'm going to find out the best language... (Score:5, Funny)
by using the search term "l33t".
WTF? Python is worse than Perl (Score:2)
Re: (Score:2)
Simple answer is because no one uses Perl anymore, so it's going to have less WTF due to less usage.
Re: (Score:3)
Re: (Score:2)
No. Its because Perl has things like "0 but true" [stackoverflow.com]. WTF? is just not strong enough.
Re: (Score:2)
The only people still using Perl are the people who know it well enough to no longer have to ask What TF is going on with it.
WTFs per nodes (Score:2)
I think the best way to evaluate this would be WTFs per node in a parse tree, or some other structure that accounts for the actual complexity of the code as opposed to the verbosity of the language. Otherwise, begin... end languages would appear less WTFy then {... } languages.
The question is really moot though. Just grepping for WTF won't tell you if it's directed at a problem related to the language (WTF doesn't this template generate what I want, Lisp macros were so much better) or the code (WTF were t
It stands to reason... (Score:2)
Re: (Score:2)
High WTF-per-minute code can be written in any language. I'm looking at code now where "l" is used frequently as a variable name (really). Does the language even matter?
Re: (Score:2)
In my view, "l" might be an acceptable variable name in a scope that is only 2 or 3 lines long, and even then, only where it's pretty damn obvious even to a complete newbie who is barely qualified to be maintaining or making any changes to that code what they were thinking when they called it "l" in the first place, such as if it is explicitly being assigned as the length of something such as a string.
In fact, I can't think of any other remotely valid reason to call a variable "l", and to be perfectly ho
Legitimate WTF instances (Score:2)
I challenge anyone to show me a legitimate instance of WTF in code.
I'm going to ... (Score:2)
They forgot SQL! (Score:5, Insightful)
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
Bad Article Title (Score:3)
Just becuase a language allows it... (Score:2)
...doesn't mean you should shout "fire!" in a crowed theater.
As a C++ developer I wholeheartedly agree (Score:3)
When I have been part of interviewing new hires, I've tended to ask this question: "what do you find frustrating about C++?"
If you really know C++, there are bound to be at least a few things that you find frustrating. The lack of standardisation on binary interfaces, the continued drive for flexibility at all costs (resulting in a million ways to do one simple thing) and the way they have ALWAYS emphasised pattern clutches over improving the language. Despite (or perhaps because of) the near-complete lack of ABI compatibility between versions, they nearly never remove or depricate anything in the the standard or the STL API, meaning any new "simplification" always comes in addition to the old way, it never replaces it. Sadly this means the standard is never actually simplified, they just add yet another layer of abstraction, which always leaks [joelonsoftware.com]. Lots of the STL and the standard patterns used by C++ developers are really clever and I'm sure they were intensily satisfying to develop. But satisfying cleverness is not necessarily something to build a programming language on.
The worst part is that the patterns and algorithms which were developed to work around gaps in the core language actually become arguments not to improve the core language. Let's face it; as much as I've used std::for_each, it should never have existed. Instead, range-based for-loops should have been in way before C++11.
The c++ FQA [yosefk.com] sums up some of my own frustrations.
That said. There is no other language with such easy access to such a myriad of great libraries out there, especially for science/engineering/visualisation, and for this reason I cannot agree with the FQA's notion that there are no reason to start new projects in C++. By using these libraries, your own code could well become quite elegant and you would shoot yourself in the foot if you decided to avoid C++ on principle for a situation where C++ and its large set of libraries would solve your problem.
Re: (Score:3)
I have been writing C++ for over 20 years. I love it. But I also think Java and Python are decent languages as well (and I have heard great things about Ruby).
Re: (Score:2)
PS you haven't lived until you have written a Python extension in C++ (which of course lives in a C wrapper). Good clean fun, that.
Re: (Score:2)
I don't think he's discounting someone who wants to use a pre-existing library. He's saying he enjoys making them write libraries because one doesn't exist for the given task. But i think calling people coming out of college idiots is itself idiotic. College doesn't teach people to be good and experienced programmers/developers. It gives them a lot of different experiences. He calls C#, Java, Ruby, and Python garbage because he probably has never worked with them. I'm sure he still writes his website'