Comment On Double Line

We've got two different representative lines from two entirely different systems. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Double Line

2011-08-25 10:03 • by QJo (unregistered)
FristOfManyCommentsOrItWillBeIfICanFinishWritingItBeforeSomeoneElseGetsThereBeforeMeAlthoughIKnowThisIsProbablyAFairlyForlornHope

And Akismet thinks it's spam. What is he on?

Re: Double Line

2011-08-25 10:17 • by Akismet (unregistered)
358387 in reply to 358385
QJo:
FristOfManyCommentsOrItWillBeIfICanFinishWritingItBeforeSomeoneElseGetsThereBeforeMeAlthoughIKnowThisIsProbablyAFairlyForlornHope

And Akismet thinks it's spam. What is he on?


Crack, mostly.

Re: Double Line

2011-08-25 10:18 • by DonaldK (unregistered)
Double FRIST

Or maybe not.

Re: Double Line

2011-08-25 10:18 • by tehR (unregistered)
It's self-documenting code. D'uh.

Re: Double Line

2011-08-25 10:18 • by Charleh (unregistered)
Wow, almost frist never seen so little comments on a WTF - must have clicked on at the instant it was posted.

By the time I've finished writing this, I predict there will be at least 5 other comments...

Re: Double Line

2011-08-25 10:21 • by ubersoldat
Ah! This reminds me of some code I found from some guy who really loved Grails dynamic finders, but this guy took the concept to another level:

findAllByDateTimeReceivedBetweenAndAmountLeftJoinByIdsGroupByAmountBookUserTitle(java.sql.Date date)

Not exactly the name of the method, but you get the idea.

Re: Double Line

2011-08-25 10:23 • by QJo (unregistered)
I've thought of a way to improve it:

public bool SSPCSPPAUPPAUPMTBDNMAPTHNDPA
{
get;
set;
}

... cut the name down to its initials. A dramatic improvement, though I say it myself.

Re: Double Line

2011-08-25 10:31 • by Melnorme
int length = 3;

Optimized.

Re: Double Line

2011-08-25 10:37 • by BentFranklin
The first one seems to be a sarcastic response to something a PHB might have said.

Re: Double Line

2011-08-25 10:38 • by Jerry (unregistered)
print $commentNumber%8?"TRWTF is VB":"Frist!"

Re: Double Line

2011-08-25 10:40 • by Warren (unregistered)
Clay continues, "someone should write a plug-in that limits method names to a sane amount of characters."

He submitted it using the Daily WTF add-in. That limits bad practice for most of us....

Re: Double Line

2011-08-25 10:45 • by ThingGuy McGuyThing
I'm not sure how this is going to "corrupt data".

int length = data.GetRange(0, 3).ToArray().Length;


The summary (seems to) state that data will be a 3-character string. I thought maybe it was failing on 0/1/2-character strings, but GetRange would throw an exception, rather than "corrupting data".

Either the summary is confusing, or I'm missing something fundamental. 50/50 odds, I'd say.

Re: Double Line

2011-08-25 10:50 • by snoofle
Imagine the auto-complete fun if there were several similarly named functions:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready1
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready2
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready3

Re: Double Line

2011-08-25 10:51 • by AP2 (unregistered)
When Martin Fowler wrote "Code As Documention", I think that wasn't what he had in mind.

Re: Double Line

2011-08-25 10:52 • by frits
I'm usually pro Camel/Pascal casing. However, this WTF shows readability does seem to break down with very long variable names. Maybe I'll join the underscore camp now.
//See- so much better

public bool Setting_Store_Price_Changes_Store_Product_Price_And_Updates_Product_Price_And_Updates_Product_Modified_Timestamp_But_Does_Not_Modify_A_Product_That_Has_Non_Default_Pricing_Already
{
set;
get;
}

Re: Double Line

2011-08-25 10:55 • by GFK
int length = data.GetRange(0, 3).ToArray().Length;


When you see stuff like that in one of those applications, you know somewhere up in the call stack there's something like

try
{
// Use the data
...
}
catch(ArgumentException)
{
// OPTIMIZATION!!
// To avoid testing if data.Length < 3, I'll just catch
// the exception thrown here
DoSomeVeryImportantStuffInCaseTheLengthOfDataIsInferiorToThreeBecauseExceptionsAreLikeReturnsAndCatchClausesIsWhereRealMenDoBusinessLogic();
}


that you will totally break if you correct the aforementioned line.

Re: Double Line

2011-08-25 10:55 • by hfrmobile
For the first thing, StyleCop will give you a warning for such beautiful and descriptive names. StyleCop will also warn you if you forgot providing /// comments for public properties, methods, ...

But such smart developers will disable that warnings ^^

Re: Double Line

2011-08-25 10:56 • by Fjool (unregistered)
Having 'and' in a method/test name is a smell indicating the method is doing more than it should. In this case, however... :?

captcha: consequat - the results of eating an overripe kumquat

Re: Double Line

2011-08-25 11:02 • by Zylon
358405 in reply to 358404
Fjool:
Having 'and' in a method/test name is a smell indicating the method is doing more than it should. In this case, however... :?

function crashAndBurn()

Re: Double Line

2011-08-25 11:03 • by piskvorr
...AndMakesYouCoffeeAndFixesTheKitchenSinkToo()

and this and that and another thing, and it adds up to nothing in particular.

Re: Double Line

2011-08-25 11:06 • by GFK
358407 in reply to 358400
frits:
I'm usually pro Camel/Pascal casing. However, this WTF shows readability does seem to break down with very long variable names. Maybe I'll join the underscore camp now.
//See- so much better

public bool Setting_Store_Price_Changes_Store_Product_Price_And_Updates_Product_Price_And_Updates_Product_Modified_Timestamp_But_Does_Not_Modify_A_Product_That_Has_Non_Default_Pricing_Already
{
set;
get;
}



I prefer fluent stuff, because you can use returns! So much more readable like this:

Setting(Store.Price
.Changes(
Store().Product.Price
.And(
Updates(
Product.Price
.And(Updates(Product.Modified(Timestamp()
.But(Does
.Not()
.Modify(A.Product
.That().Has(Non().Default.Pricing.Already()
))))))))));

Re: Double Line

2011-08-25 11:06 • by anonymous (unregistered)
358408 in reply to 358390
Charleh:
Wow, almost frist never seen so little comments on a WTF - must have clicked on at the instant it was posted.

By the time I've finished writing this, I predict there will be at least 5 other comments...

!nostradamus

Re: Double Line

2011-08-25 11:07 • by frits
The first one is actually from obfuscated code. The developer used a product called ItWorksBecauseItTurnsAllPropertyNamesIntoLongWindedNonsenseAndMostDevelopersHaveADHDAndWillLoseInterestFuscator.

Re: Double Line

2011-08-25 11:19 • by OneMist8k (unregistered)
Apropos of the WTF on female programmers, I'm going to guess the gender of each programmer.

The first one was written by a female who likes long members.

The second was written by a male who thinks length doesn't matter.

Re: Double Line

2011-08-25 11:21 • by boog
358411 in reply to 358398
snoofle:
Imagine the auto-complete fun if there were several similarly named functions:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready1
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready2
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready3
Could this really be a case where it's better design (for maintenance' sake) to put a number at the end of the function? You could easily look at the end of the name to know what you're dealing with.

Consider the alternative:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceButDoesNotUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceOrUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceButDoesUpdateProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndHolyShitsnacksIHopeNobodyHasToMaintainThisSinceItsHardToSeeDifferencesInTheseNamesWhenTheyreNotLinedUpAboveEachOther

Re: Double Line

2011-08-25 11:22 • by Abso (unregistered)
358412 in reply to 358400
frits:
I'm usually pro Camel/Pascal casing. However, this WTF shows readability does seem to break down with very long variable names. Maybe I'll join the underscore camp now.


I think it's improved even more if you don't mix the two systems. That is, do use underscores, but don't capitalize every word.

Look at how nearly-readable this is!

public bool Setting_store_price_changes_store_product_price_and_updates_product_price_and_updates_product_modified_timestamp_but_does_not_modify_a_product_that_has_non_default_pricing_already
{
set;
get;
}

Re: Double Line

2011-08-25 11:34 • by Someone who can't be bothered to login from work (unregistered)
358415 in reply to 358403
hfrmobile:
For the first thing, StyleCop will give you a warning for such beautiful and descriptive names. StyleCop will also warn you if you forgot providing /// comments for public properties, methods, ...

But such smart developers will disable that warnings ^^


Only if they don't also use StyleCop, which will by default complain about exactly the same thing. In fact it will complain about them being missing on private ones too.

Documenting things using the native documenting system is hardly a terrible idea. Especially given Visual Studio will show those comments if you hover over a reference.

Re: Double Line

2011-08-25 11:37 • by thistooshallpass
358416 in reply to 358392
QJo:
I've thought of a way to improve it:

public bool SSPCSPPAUPPAUPMTBDNMAPTHNDPA
{
get;
set;
}

... cut the name down to its initials. A dramatic improvement, though I say it myself.


Send your resume to Peoplesoft, they hire people like you to design their data model.

Why use a long name when "PSAESTEPMSGDEFN" will do the trick?

Re: Double Line

2011-08-25 11:37 • by Rawr (unregistered)
358417 in reply to 358400
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool ChangingStorePriceModifiesProductInfo
{
set;
get;
}

Re: Double Line

2011-08-25 11:40 • by virago (unregistered)
358418 in reply to 358410
OneMist8k:
Apropos of the WTF on female programmers, I'm going to guess the gender of each programmer.

The first one was written by a female who likes long members.

The second was written by a male who thinks length doesn't matter.



That's so disgustingly sexist I'm going to reply angrily to every single post I see from now till the next WTF is posted. Come the revolution, every computer software engineer will be female and those nasty geeky nerdy boys will be banished to wherever those nasty asperger types belong.

Re: Double Line

2011-08-25 11:42 • by QJo (unregistered)
358419 in reply to 358411
boog:
snoofle:
Imagine the auto-complete fun if there were several similarly named functions:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready1
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready2
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready3
Could this really be a case where it's better design (for maintenance' sake) to put a number at the end of the function? You could easily look at the end of the name to know what you're dealing with.

Consider the alternative:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceButDoesNotUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceOrUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceButDoesUpdateProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndHolyShitsnacksIHopeNobodyHasToMaintainThisSinceItsHardToSeeDifferencesInTheseNamesWhenTheyreNotLinedUpAboveEachOther


This post is the first one I've read on this site which actually makes me feel quite ill. Well done, that man.

Re: Double Line

2011-08-25 12:05 • by ~~ (unregistered)
Variable name for all the ZX Spectrum users:
"this name is so long that I shall never be able to type it out again without making a mistake"

;)

Re: Double Line

2011-08-25 12:06 • by Uncle Al (unregistered)
358425 in reply to 358417
Rawr:
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool ChangingStorePriceModifiesProductInfo
{
set;
get;
}




No, no, no. Clearly, the right approach is:
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
{
set;
get;
}





Re: Double Line

2011-08-25 12:09 • by Abso (unregistered)
358426 in reply to 358410
OneMist8k:
Apropos of the WTF on female programmers, I'm going to guess the gender of each programmer.

The first one was written by a male who likes to claim he has a long member.

The second was written by a male who habitually lies about length.


FTFY

A female programmer would be more concerned with width.

Re: Double Line

2011-08-25 12:24 • by boog
358427 in reply to 358419
QJo:
boog:
snoofle:
Imagine the auto-complete fun if there were several similarly named functions:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready1
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready2
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready3
Could this really be a case where it's better design (for maintenance' sake) to put a number at the end of the function? You could easily look at the end of the name to know what you're dealing with.

Consider the alternative:

SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceButDoesNotUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceOrUpdateProductModifiedTimestampOrModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceButDoesNotUpdateProductPriceButDoesUpdateProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndHolyShitsnacksIHopeNobodyHasToMaintainThisSinceItsHardToSeeDifferencesInTheseNamesWhenTheyreNotLinedUpAboveEachOther


This post is the first one I've read on this site which actually makes me feel quite ill. Well done, that man.
I aim to quease.

Re: Double Line

2011-08-25 12:27 • by BentFranklin
Maybe IDEs should come with a tinyurl-like feature from now on.

Re: Double Line

2011-08-25 12:40 • by Paul (unregistered)
I sentence the first offender to 1 year of coding with autocomplete disabled. *bangs gavel*

Re: Double Line

2011-08-25 12:41 • by Huey Lewis (unregistered)
Testing? We don't need no stinking testing. The first rule is... if it compiles, move it to production.

Re: Double Line

2011-08-25 12:56 • by airdrik (unregistered)
358434 in reply to 358425
Uncle Al:
Rawr:
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool ChangingStorePriceModifiesProductInfo
{
set;
get;
}



No, no, no. Clearly, the right approach is:
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
{
set;
get;
}




No, no, no. Clearly you are moving in the wrong direction. We want small, concise variable names:
/// <summary>

/// Setting store price changes store product price and updates product price and updates product modified timestamp but does not modify a product that has non default pricing already.
/// </summary>

public bool Setting463
{
set;
get;
}

Re: Double Line

2011-08-25 13:00 • by The Most Interesting Man in the World (Dos Equis Guy) (unregistered)
358435 in reply to 358431
Huey Lewis:
Testing? We don't need no stinking testing. The first rule is... if it compiles, move it to production.
I don't always test my code, but when I do, I do it in production.

Re: Double Line

2011-08-25 13:11 • by PedanticCurmudgeon
358436 in reply to 358394
BentFranklin:
The first one seems to be a sarcastic response to something a PHB might have said.
Malicious compliance FTW!

Re: Double Line

2011-08-25 13:30 • by caper (unregistered)
"Maybe I'll join the underscore camp now."

Please do.
camelCase is in my opinion useless for anything which is more than two small words stuck together.

Re: Double Line

2011-08-25 13:33 • by NobodyCares (unregistered)
358438 in reply to 358397
ThingGuy McGuyThing:
I'm not sure how this is going to "corrupt data".

int length = data.GetRange(0, 3).ToArray().Length;


The summary (seems to) state that data will be a 3-character string. I thought maybe it was failing on 0/1/2-character strings, but GetRange would throw an exception, rather than "corrupting data".

Either the summary is confusing, or I'm missing something fundamental. 50/50 odds, I'd say.



Given the only GetRange I know of in .NET is this, then I'd tend to say we've been sadly mislead. Par for the course, I suppose.

I suspect that "data" is a list of strings, and if there's more than 3 of them then some were being ignored, which lead to much amusement later on in the form of missing messages or whatnot.

Re: Double Line

2011-08-25 13:36 • by Coyne
358439 in reply to 358394
BentFranklin:
The first one seems to be a sarcastic response to something a PHB might have said.


...or based on a PHB-mandated standard.

Re: Double Line

2011-08-25 13:39 • by Hortical (unregistered)
358440 in reply to 358426
Abso:
OneMist8k:
I'm going to guess the gender of each programmer.

The first one was written by a male who likes to claim he has a long member.

The second was written by a male who habitually lies about length.
FTFY
No ones pipes up to call that sexist.

Abso:
A female programmer would be more concerned with width.
But that's blatant misogyny and chauvinism. How can you generalize about women like that?

Re: Double Line

2011-08-25 13:40 • by frits
358441 in reply to 358437
caper:
"Maybe I'll join the underscore camp now."

Please do.
camelCase is in my opinion useless for anything which is more than two small words stuck together.


98% of my variable and Type names are two words stuck together, so I think I'm good right here.

Re: Double Line

2011-08-25 13:45 • by boog
358442 in reply to 358437
caper:
"Maybe I'll join the underscore camp now."

Please do.
camelCase is in my opinion useless for anything which is more than two small words stuck together.
But to be fair, anything more than two small words stuck together is often in my opinion useless for naming variables.

Then again, I'm in the "Who cares? Neither camelCase nor underscores makes code hard to maintain; code like today's examples do" camp. It's a pretty good camp. The food is so-so.

Re: Double Line

2011-08-25 13:45 • by FuBar (unregistered)
358443 in reply to 358400
frits:
Setting_Store_Price_Changes_Store_Product_Price_And_Updates_Product_Price_And_Updates_Product_Modified_Timestamp_But_Does_Not_Modify_A_Product_That_Has_Non_Default_Pricing_Already
I don't understand why we ever left COBOL. It just worked. For business programming, anyway.

Re: Double Line

2011-08-25 13:52 • by corwin766 (unregistered)
358445 in reply to 358443
FuBar:
frits:
Setting_Store_Price_Changes_Store_Product_Price_And_Updates_Product_Price_And_Updates_Product_Modified_Timestamp_But_Does_Not_Modify_A_Product_That_Has_Non_Default_Pricing_Already
I don't understand why we ever left COBOL. It just worked. For business programming, anyway.


I left COBOL because it gave me repetitive stress injury. No other language has accomplished that.

COBOL design motto:Why use 1 character when 10 will do?

Re: Double Line

2011-08-25 13:56 • by dguthurts (unregistered)
358446 in reply to 358410
OneMist8k:
Apropos of the WTF on female programmers, I'm going to guess the gender of each programmer.

The first one was written by a female who likes long members.

The second was written by a male who thinks length doesn't matter.



Best_Comment_Of_The_Day
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment