- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
It's been around longer than 15 years - I was using it (With some of the first .NET Betas) in 2001... It was first penned (When it was known as 'Cool - C-Like Object Oriented Language') in '99.
Admin
You may want to remove the company name from the screenshots
Admin
Who is Viginia?
Admin
TRWTF is computers.
Admin
I want this carved in gold above my fireplace. Might get this tattooed too.
Admin
Anyone else notice that the files in the screenshots are different? frmDemandes.cs is at least 24,000 lines long from the first screen shot, where as frmTAB_Interventions.cs is nearly 40,000 lines.
Admin
I recommend reading the HTML comments.
Admin
The first thing to do is to start swinging wildly at all that shit that does nothing. After a couple months of that, the code base should have dropped a few % in size. Then have at all the copy-paste code that exist within, wherever it's found. That'll cut the size down to at least 2/3. And then the hard part starts, actually making the code structured and sensible.
I've seen similar code in C++. That was a real treat.
Admin
Somebody needs to create a Visual Studio extension that responds to pastes of more than 5000 lines of code with a message saying "this incident will be reported to the appropriate authorities." Then it should put a comment at the end of the file saying "Remy Porter pasted 17000 lines into this file on April 6, 2002" or whatever. (I know Remy would never do that but you catch my drift.)
In the meantime, hey Resharper guys, you have a bug.
Software's growing up. This is the real world. Try repairing the signaling system in the Boston or London subway system if you think this is hard. Virginia is a real engineer.
Admin
Paid by the line, I take it?
Admin
Remy, you should patent this method and sell it to the president:
"Obama wiretapped me, sick guy!" <!-- Not Obama himself, and not me, but someone wiretapped someone sometime. -->
"My inauguaration crowd was the yugest evar!" <!-- ... something about alternative realities .... -->
Srsly, this HTML comments stuff was funny the first one or two thousand times, but can't you use footnotes like everyone else?
Admin
Gotta note that
if ( demandesDataRowView["SGESDEM_SOC"].ToString().Equals(demandesDataRowView["SGESDEM_SIG"].ToString()) && demandesDataRowView["SGESDEM_SIG"].ToString().Length > 0 ) sSocieteCour = demandesDataRowView["SGESDEM_SIG"].ToString(); else sSocieteCour = demandesDataRowView["SGESDEM_SOC"].ToString();
seems to be not as meaningful as Remy believes.You can summarize the code as
IF the string in SGESDEM_SIG is the same as the string in SGESDEM_SOC use the string in SGESDEM_SIG otherwise use the string in SGESDEM_SOC end-if
but, if the condition is true, then the string in SGESDEM_SIG is the same as the string in SGESDEM_SOC, and the code could be rewritten asIF the string in SGESDEM_SIG is the same as the string in SGESDEM_SOC use the string in SGESDEM_SOC otherwise use the string in SGESDEM_SOC end-if
which is a meaningless conditional.Admin
Someone so valiantly fixing WTFs that the Americans named not one, but two of their states after her.
Admin
Isn't the TRWTF the French?
Admin
A process_Exited() event handler? That code sure has some existential problems...
Admin
And in some cases, it actually gets called twice!
Admin
If only you'd gotten started a little sooner, you could say you've been using Cool before it was C#.
Admin
"You’ll note that all three calls to ChangePosition do exactly the same thing.You’ll note that all three calls to ChangePosition do exactly the same thing."
Obviously something to do with a Unicorn fetish, young man.
And exactly why is this a C#-specific WTF?
It ain't no such thing, is it? Hardly worth mentioning any flvaor of .Net at all, is it?
Mind you, given this pathetic attempt, I would love to see an F# or OCamL WFT. Baby steps, baby, baby steps. Eventually we can hope for a Haskell WTF.
Without cornification, please.
Admin
Ah no, that'd be Virginia. Viginia was mentioned once in the story (albeit in bold), but then never again.
Admin
C'mon guys, in C# you can hide some closures behind those array values, such that their (and others') values may change whenever they get "read". This "functional" programming style makes the program much more elegant and versatile.
Admin
“sort of Java with [..] security deleted.”
You mean, sort of Java but actually usable because the "security" isn't actively preventing me from doing my job? The number one reason NOT to update Java is because you don't know what will break, but you are absolutely 100% certain things ARE going to break. Newer versions are a lot more secure than older versions, simply because nothing runs anymore. Unfortunately I do need those applets...
My "Exception Site List" is filling up a large portion of my hard drive, containing a copy of our internal DNS-server and almost all IP-addresses in the RFC1918 address space, and even then I have to jump through all kinds of hoops and click boatloads of "FFS just start the applet-already"-buttons just to manage a piece of hardware...
And no, unfortunately updating all those iLO firmwares and SAN-switches and other items isn't an option... The iLO's do but most devices don't let me change the certificate used on the webserver, some of them don't have firmware released in the last 2 years so the cert is expired as well, others I can't update because that breaks other things...
Java's "security" is the main reason new equipment that requires Java must be vastly superior to the competition (that doesn't use Java) to be even considered...
Admin
Might have been useful at one time, but the business logic probably evolved, and certain edge cases became redundant and removed. But the programmer didn't go that extra braincell and review what he was left with after removing one or more no-longer-needed branches. Seen this sort of thing before. It happens on a "mature" project.
Admin
Reminds me how behind-the-curve this part of the country is.
Highschool, they taught Pascal before C but dropped C when the computer math teacher retired. So I learned C more or less on my own. College, every course was Java Java Java with a single elective for C++. So I learned as much C++ on my own as possible. Graduate and everything is .NET. WTF. I was fortunate to pick up C# quickly from C/C++.
C# 1.1 was awful though. So little of it actually worked at the time. By 2.0, they had a pretty decent environment, especially with some help from P-Invoke. Wouldn't trade Visual Studio 2008 for anything. Of course now all the jobs here are VB.NET and jQuery so all of that power is thrown away...
Admin
All of that DefineField crap I would have done with a table and a loop.
Why is it that crap programmers can't comprehend using constant initialized tables? Everything has to be a fucking subroutine call with half the line being the same characters. And good job lining them up, too.
Also, what language is "demandes" in? Ah, "sSocieteCour", so French? Hooray, let's mix two different (spoken) languages in identifier names, on top of inconsistent CamelCase! Please tell me this isn't Quebecois code. The worst thing they ever did was to fail their independence vote. This is coming from a Texan who feels sorry for the rest of Canada.
And an over 20000 line class declaration? (Or was the entire file the declaration and it's 40000? Holy shit.) One of the best anti-patterns there is. I once saw one with a few thousand lines, but it had 400+ methods with the handler for each and every screen of an app in the base class (each screen still had its own subclass), dispatched by a 16000+ line case statement, instead of using virtual methods.
The biggest problem with object-oriented programming is what happens when someone who doesn't understand it tries to write code in such a language. Yep, you can still write FORTRAN in any language.
Admin
You must be new here.
javascript:(function(){var%20e=document.getElementsByClassName("article-body")[0];e.innerHTML=e.innerHTML.replace(/<!--/g,"<div%20style='background-color:gainsboro;border:solid%201px%20black;padding:4px;color:red;'><span%20style='font-style:italic;'>").replace(/-->/g,"</span></div>").replace(/%20title="click%20me!">/g,"%20title="click%20me!">%F0%9F%90%8E");})();
Admin
You wait until you encounter code by an old-school FORTRAN programmer's output. Indentation? Sure, it's indented. Every line is indented the same, by 7 spaces.
Admin
@renneb The first screenshot is highlighting a 2000 line method, not the overall size of the file.
PS for the enlightenment of anyone who hasn't spent a decent chunk of the last 15 years using .net; those screenshots are from a very old version of Visual Studio. It looks like VS2003, but I never used '02 or '05; and haven't touched '03 in a while either. Still using VS03 suggests one of several possible WTFs, management being unwilling to upgrade or the code base having something that makes it non-upgradable without significant changes. (I ran into this myself almost a decade ago when upgrading an app from .net 1.1/VS2003 to .net3.5/VS2008 and encountering several 3rd party UI classes that I couldn't get to compile in the new version. Being stuck in the dark ages of .net means that Virginia doesn't have access to generics (just strongly typed arrays or dynamic collections that hold type object and need casting around every access), lambdas, or a big chunk of Resharpers enhancements.
Admin
Actually the code reads like
if a = b then c = a, else c = b. Which you can just replace with c = b, as c = a when a = b, and the = operator is transitive.
(Unless there's some operator overloading shenanigans or the like going on with these objects. )
Admin
Oh, I 'see'.
Admin
Yes. If you are thinking computers are hard, try playing Chess with a monkey.
Admin
"Viginia" here: nope, not paid by the line, and yes, VS 2003. In all fairness I have to mention that I most probably am one of the contributors to this code - since I have been working on the same project for 10 years (I know, TRWTF)
Admin
$("*").contents().filter(function(){ return this.nodeType == 8; }).each(function(i, e) { $('
').text(e.nodeValue).insertAfter(e); });
Admin
Comments have html stripped, '{code style="background-color: #f8f8f8; color: #58B252"}{/code}' replacing the braces with tags
Admin
"You’ll note that all three calls to ChangePosition do exactly the same thing."
Do they? I suppose ChangePosition tampers a bit with its arguments.
Besides that, you failed to notice that there are extra whitespace characters in the second call to ChangePosition. Might have a severe impact in WhitespaC#.