|
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Robert Royall wrote: I'm pretty sure all C# boolean evaluations (including if) are short-circuiting,
Yea thats correct.
|
|
|
|
|
Tadas Budvytis wrote: 99% it's used as a num
I doubt that very much. Would you perform mathematical operations on it?
|
|
|
|
|
I had the same objection to this while going through some code with the boss many years ago. I always checked for null separately before doing anything else. He did it just the same way like in the code here. He argued that the check for null values is always done first and does not run into the second term if the value is indeed null.
This may not be sound proof, but the entire code was full of this and we never had any problems because of that.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
You'll get a runtime error calling ToString on a null reference, and the null check avoids this.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
No horror here.
Tadas Budvytis wrote: well first of all if it's UserID i expect it to be number
ID is shorter for IDentification, it can be numerical value, GUID, string... almost anything programmer wants.
It's common thing for naming primary keys in RDB-s with Something + ID and usually these ID-s are integers, but that convention can be misleading for beginners.
Sometimes it's better to use other types, string or guid for instance and different naming conventions.
modified on Monday, June 2, 2008 9:05 AM
|
|
|
|
|
I wish I knew what this guy was thinking.
ddl_Operator.DataTextField = ("description").Trim
|
|
|
|
|
A Find and Replace gone crazy?
|
|
|
|
|
Probably didn't realize he could do
ddl_Operator.DataTextField = ("description").ToString() ;
nor even that the parentheses are extraneous.
|
|
|
|
|
And why not simply
ddl_Operator.DataTextField = "description"; ?
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Well, sure, but then there's no fame and glory.
|
|
|
|
|
PIEBALDconsult wrote: Probably didn't realize he could do
ddl_Operator.DataTextField = ("description").ToString() ;
or maybe..
ddl_Operator.DataTextField = ("description").ToString().ToString().ToString().ToString().Trim() ;
|
|
|
|
|
Not technically a real horror, but I just did something that looks darn scary:
return string.Format(string.Format("{{0:{0}}}", exportField.FormatString), exportField.Value);
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Is it code obfuscation?
So the creationist says: Everything must have a designer. God designed everything.
I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?
|
|
|
|
|
by name? Probably not.
by value? Obviously.... it violates the Thirty Second Rule (a single line of code shouldn't take that long to parse in your head)
Wirth would be proud.
Jeff Dickey
Seven Sigma Software and Services
Phone/SMS: +65 8333 4403
Yahoo! IM: jeff_dickey
MSN IM: jeff_dickey at hotmail.com
ICQ IM: 8053918
Skype: jeff_dickey
|
|
|
|
|
Jeff Dickey wrote: it violates Thirty Second Rule
So what are rules 1 to 31?
|
|
|
|
|
mmmmppphhhh.... must.....not....give in....to....obviously.....brainless.....insipid.....TROLLS!
Jeff Dickey
Seven Sigma Software and Services
Phone/SMS: +65 8333 4403
Yahoo! IM: jeff_dickey
MSN IM: jeff_dickey at hotmail.com
ICQ IM: 8053918
Skype: jeff_dickey
|
|
|
|
|
Jeff Dickey wrote: it violates the Thirty Second Rule (a single line of code shouldn't take that long to parse in your head)
Ummmm
List<vartiklcjenik> tablica = dc.vArtiklCjeniks.Where(sg => sg.StrankaID == s.StrankaID || (sg.StrankaID == null && dc.vArtiklCjeniks.Where(sg1 => sg1.ArtiklID == sg.ArtiklID && sg1.StrankaID == s.StrankaID).Count() == 0)).ToList();
How about that? Does this qualify as coding horror?
|
|
|
|
|
Not really
|
|
|
|
|
Did I hear someone say "Quine"?
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Why didn't you do it this way:
return string.Format(exportField.FormatString, exportField.Value);
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The format string for the export column doesn't contain the indexer for the composite format, i.e., I need "{0:0000.0000}" as a composite format, but the format string for the column doesn't care that it is format item with index 0, and is just "0000.0000".
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
I found this in one of my older projects:
if (DateTime.TryParse(TB_BuildYear.Text, out buildYear))
buildYear = buildYear;
else
error += "The build year you have entered is invalid\r\n";
One of these cases where not just using the variable but checking the value would have been better.
Alternatively I could have used empty curly brackets instead.
|
|
|
|
|
if (!DateTime.TryParse(TB_BuildYear.Text, out buildYear))
error += "The build year you have entered is invalid\r\n";
You mean this?
|
|
|
|
|
maybe it's like... you just want to be sure
(yes|no|maybe)*
|
|
|
|