Comment On TalesFromTheLongMethodNameGenerator(int maxLength)

"I recently started a new job," writes D.Z., "and one of my tasks is to maintain a $DEITY-forsaken piece of software, written originally in VB.NET, then mutated and mutilated into C#." [expand full text]
« PrevPage 1 | Page 2Next »

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:06 • by Shambo (unregistered)
Can't you get in trouble for posting diebold source code?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:13 • by bobday
public void First()
{
//Yeeeay!
}
refactored to

public void AlmostFirstIfOnlyIWasAFewSecondsEarlierThenItWouldntBeSoLong_MaybeNextTime()
{
//Booo
}

ThisIsMyCommentOnTheDailyWTFArticleEntitledTalesFromTheLongMethodNameGenerator(int maxLength)PublishedOnTuesdayMay27

2008-05-27 08:13 • by Todd (unregistered)
I thought it was funny.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:14 • by xix (unregistered)
How to do self-documenting code right:
Write your comment for the method, remove the spaces, and then make it the method name. WorksEveryTime()

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:14 • by dkf
ThisIsAVeryLongCommentThatIsAllOneCallFromThatCode(orWouldBeExceptICan,tBeBotheredToWriteThatMuch);

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:21 • by Lexarius
At least when this eventually crashes, the stack trace will be unusually descriptive.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:28 • by jo42
196855 in reply to 196848
Shambo:
Can't you get in trouble for posting diebold source code?

Only if he posts

private void RigTheResultsSoThatTheBushiesWinAgain()
{
}

code.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:41 • by Anonymous Cow-herd (unregistered)
Use of the m_ prefix combined with German-style agglutination - is this Austro-Hungarian Notation?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:53 • by matt (unregistered)
Buy yourself a fedora.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:54 • by ender
WhoNeedsCommentsAnyway?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 08:54 • by Numeromancer

ThisIsTheBeginningOfTheFunctionNameWhichYouHaveJustFinishedReading();

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:02 • by lmollea
max identifier/function name length increased in compilers + auto-completion + camel case = headache

ok, this comment is not LongMethodName(TM) compliant...

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:12 • by Dave (unregistered)
I love that they abbreviated check in the first occurance:

chkApplyUpdateToMainAndFutureRecords.Checked

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:13 • by Trawn (unregistered)
This must be a Diebold/Seqouia coder. Check for

if (CandidateIsARepublicanAndWeNeedToWin()){

AddRandomExtraVoteToRepublican();
SendExtraPennyToRandomOffshoreCodingFirm();
}

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:29 • by Aaron
196874 in reply to 196854
Lexarius:
At least when this eventually crashes, the stack trace will be unusually descriptive.

Not to mention several megabytes long. Hope they're not having their stack traces automatically e-mailed.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:30 • by lolzJ (unregistered)
Hey, look on the bright side, at least you don't have to read comments to figure out what it's doing! Oh wait.. 0_o

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:37 • by JCDenton
At least they're descriptive... when unsure use a method/class name generator: http://www.classnamer.com/

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:40 • by abx
I call shenanigans! Given the amount of bad code this guy presumably has to encounter every day, long method names CAN'T be the thing that annoys him the most.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:40 • by Chucara (unregistered)
This is why I insist on a "Maximum 3 letters for function names" code standard.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:42 • by WC (unregistered)
196887 in reply to 196866
Dave:
I love that they abbreviated check in the first occurance:

chkApplyUpdateToMainAndFutureRecords.Checked



I love that you have no idea why.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:43 • by DaveK
196888 in reply to 196885
Chucara:
This is why I insist on a "Maximum 3 letters for function names" code standard.

Three letters should be enough for anybody. After all, that's all you need for "YES", "NO" and "FNF".

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:49 • by Rob (unregistered)
Better too long than too short, as the ladies say (not mine, unfortunately).

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:53 • by Symbiatch (unregistered)
Fortunately Visual Studio has refactoring so you can change those to something "a bit" better. But still, takes a lot of time...

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:57 • by Shinobu (unregistered)
Use of uninitialized value in concatenation (.) or string interpolation at TalesFromTheLongMethodNameGenerator(int maxLength) line 1.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 09:59 • by Jim (unregistered)
This is code from a Diebold voting machine, right?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 10:10 • by Jeff (unregistered)
Ah, the prose (but not pros) way to code.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 10:11 • by NeoMojo (unregistered)
196899 in reply to 196885
Chucara:
This is why I insist on a "Maximum 3 letters for function names" code standard.
It's been the standard since 1983 for a reason!

WC:
Dave:
I love that they abbreviated check in the first occurance:

chkApplyUpdateToMainAndFutureRecords.Checked



I love that you have no idea why.

So much love!

I should probably mention Diebold, just to be with the in crowd. Also, I like sounding political.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 10:19 • by NevroMance (unregistered)
Cool. A nice way of not having to comment the code.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 10:25 • by Seltsam
I worked with one of these guys.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 10:38 • by rk (unregistered)
I lol'ed

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:00 • by hibikir (unregistered)
At work, we have the ThunderCougarFalconBird rule: If a class, variable or method name is as long as ThunderCougarFalconBird, it's way too long.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:01 • by Dave (unregistered)
while( LongVariableNamesCanBeHelpfulInUnderstandingCode &&
//YouCanDefinitelyGoTooFarTheOtherWayAndMakeAcronymsOutOfEachVariable
ycdgtftowamaooev )
{
ThisDoesNotMeanThatYouCanMakeUpFor( Design.Unintelligible | Design.AbsolutelyNone ); //ByMeansOfLongVariableNames
}

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:04 • by FixedThat4ya (unregistered)
196915 in reply to 196855
jo42:
Shambo:
Can't you get in trouble for posting diebold source code?

Only if he posts

private void RigTheResultsSoThatTheBushiesWinAgain()
{
}

code.

[/sarcasm]



Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:04 • by real_aardvark
Well, I don't know about anybody else, but I went blind before I could read to the end of the first method name.

Don't they have goggles for this sort of thing?

I'm intrigued by the parameter name, however. "electionDate?" It's not very descriptive under the circumstances, is it?

Did the guy get RSI, or is it just that every single election occurs on the same date?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:08 • by real_aardvark
196918 in reply to 196851
xix:
How to do self-documenting code right:
Write your comment for the method, remove the spaces, and then make it the method name. WorksEveryTime()
What, OhFuckIveLostTheWillToLiveAndJustPostedOnYouTubeAndNowImGoingToClimbATowerAnd SprayRandomPassersByWithAHighPoweredAutomaticWeapon?

What use would that be?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:17 • by no one of significance (unregistered)
I wouldn't be able to start my day as a developer without my trusty fedora.

Then there's the guy I used to work with who'd write code with The Raiders March blaring in the background.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:20 • by Spectre
Okay, the real WTF(R) is migrating from VB .NET to C#. What's the point?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:21 • by danixdefcon5
private void shouldntYouBeUsingLowerCaseInTheBeginningOfTheMethodName(String yes)
{
}

Now I know why no-one trusts Diebold voting machines... ;)

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:31 • by SomeCoder (unregistered)
196943 in reply to 196910
hibikir:
At work, we have the ThunderCougarFalconBird rule: If a class, variable or method name is as long as ThunderCougarFalconBird, it's way too long.


One word.... ThunderCougarFalconBird.

Futurama FTW.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 11:34 • by Vincent Curry (unregistered)
What a lovely thought. This code is used in election systems. No wonder people don't have faith in them...

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 12:06 • by Yohance (unregistered)
how about this one

public theBestThingAboutThisMethodNameIsThatByTheTimeYouFinishReadingItYouRealizeThatItSaysNothing (int variable){
}

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 12:18 • by Sander Hoogendoorn (unregistered)
I've read carefully throughout all the comments on this peculiar post. Didn't anybody notice that the developers of this beautifully titled method aren't even aware of the abundant use of boolean logic in this code? Maybe it's because I'm a bit authistic, but if people write code like this:

if (electionDate < DateTime.Today)

{
chkApplyUpdateToMainAndFutureRecords.Checked = false;
}
else
{
chkApplyUpdateToMainAndFutureRecords.Checked = true;
}


I just have to refactor it. Just can't leave this poor method like this. I would suggest the following line of code.

chkApplyUpdateToMainAndFutureRecords.Checked = (electionDate < DateTime.Today);

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 12:27 • by Harrow (unregistered)
I think removing the spaces from a descriptive comment to generate a method name is a wussy weinie way to go. REAL programmers name a method by extracting the alphanumeric characters from the CODE:

function begin_JJ_ColorToRGB_aiWinColor_KK_not_JJ_LL_JJ_for_II_1_to_7_do_begin_LL_LL_shr_1_or_808080_KK_KK_and_LL_end_result_JJ_or_KK_end( aiWinColor : longint ) : longint;

var II, JJ, KK, LL : longint;
begin
JJ := ColorToRGB(aiWinColor);
KK := not JJ;
LL := JJ;
for II := 1 to 7 do begin
LL := (LL shr 1) or $808080;
KK := KK and LL;
end;
result := JJ or KK;
end;

-Harrow.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:04 • by duffolonious (unregistered)
Don't tell me... this is code from a Diebold voting machine isn't it?

See if it has the "GeorgeWalkerBushGuaranteedVictoryForThe2004ElectionsByWayOfVoteRedistributionAndDiscounting ofPeopleWithUnAmericanNames" method.

Be sure of the result as well:

{
...
//return McCain;
//return Obama;
return Darth_Vader;
}

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:11 • by real_aardvark
196978 in reply to 196931
no one of significance:
I wouldn't be able to start my day as a developer without my trusty fedora.

Then there's the guy I used to work with who'd write code with The Raiders March blaring in the background.
What you actually need is the intro from Hans Pfitzner's "Palestrina."

Trust me. It's quite relaxing.

You can lie on the couch and tell me about it later. My rates are reasonable.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:15 • by real_aardvark
196980 in reply to 196976
duffolonious:
Don't tell me... this is code from a Diebold voting machine isn't it?

See if it has the "GeorgeWalkerBushGuaranteedVictoryForThe2004ElectionsByWayOfVoteRedistributionAndDiscounting ofPeopleWithUnAmericanNames" method.

Be sure of the result as well:

{
...
//return McCain;
//return Obama;
return Darth_Vader;
}
Are you seriously insulting Darth Vader by comparing him to George Bush?

Or are you just suggesting that Diebold machines might have the occasional technical glitch?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:26 • by Edward Royce (unregistered)
196985 in reply to 196867
Trawn:
This must be a Diebold/Seqouia coder. Check for

if (CandidateIsARepublicanAndWeNeedToWin()){

AddRandomExtraVoteToRepublican();
SendExtraPennyToRandomOffshoreCodingFirm();
}


Sooooo. Tell me. Who was it that went to prison for stuffing the ballot box in St. Louis? What party did they belong to?

Democrat? Right in one.

Sooooo. Who was it that won the governor race in Washington by 300 votes? Which county was it that found extra votes for the Democrats several times in the most unlikely of places? And the party of the election officials in that county?

Democrat? Right in one.

Stop being a dumbass. So far this place is fairly non-political. But if you want to turn this into a political fight then I'm more than pleased to start jacking your idiot ass right on up.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:27 • by notromda
As in the english language, this is an error. It's called a run-on sentence. Variable names or functions should not be a whole sentence in themselves, they are only part of the whole sentence.

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:28 • by Edward Royce (unregistered)
196988 in reply to 196885
Chucara:
This is why I insist on a "Maximum 3 letters for function names" code standard.


I like letter + number combinations.

Who can't tell what function A0921 does?

Re: TalesFromTheLongMethodNameGenerator(int maxLength)

2008-05-27 13:29 • by Edward Royce (unregistered)
196989 in reply to 196891
Rob:
Better too long than too short, as the ladies say (not mine, unfortunately).


Unfortunately?

So your lady says "better too short than too long"??
« PrevPage 1 | Page 2Next »

Add Comment