- 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
... does that code turn into an ASCII art magic-eye picture if you use a monospaced font?
there has to be some sort of a redeeming quality to it :(
Admin
I am just VERY handsome.
Admin
Yes this code is real.
Props to the guy who recognized this is a table from Solomon. Or rather Microsoft Dynamics SL now. More importantly, this code was expensive!! And still sold as way to easily and safely interface with MS Dynamics SL.
Admin
This is funny! Solomon code. Recognized it right away.
Admin
That is a perfect example of how code should be written... i write code like that all the time
Admin
I think it's a generated code.
Admin
Microsoft SQL Server has a callable routine that will double the quotes and stuff. I'm sure the other dialects of SQL have the same thing.
Admin
Admin
He would be fired!
Admin
You do realize with the very act of stripping the last ", " from an immutable string, you now have created TWO gigantic strings, instead of one. The only way I can see that NOT happening would be if there's some way to "strip" or "shorten" the stringbuilder before you call sb.ToString() or during some call that converts to a string without the last two or so characters, in which case I'd agree with you. Otherwise there's nothing wrong with the above code.
Admin
TRWTF is the incorrect line wrapping and the redundant parentheses.
return str + "'" + this.Acct.Replace("'", "''") + "', " + "" + this.AcctDist.ToString().Trim() + ", " + "'" + this.BatNbr.Replace("'", "''") + "', " + ...
Doing it this way makes it clear that the text types have an extra single quote at the front and the back, and internal single quotes doubled up; numeric types are ToString()'d.
OK, maybe .ToString().Trim() is a WTF. Why would you need to Trim()? Even if ToString() somehow added spaces to the number, the SQL would ignore them.
Adding the blank strings is also a little strange.
But if you're going to add line breaks, do it right.
Admin
Perl FTW: return join(",", map { ... } @values);
Admin
was that ASCII art?
Admin
Admin
Dude, that's THREE words! ;)
Admin
Actually, it is in alphabetical order because the data comes from Solomon Accounting, which puts all its fields in alphabetical order.
Admin
How does someone with so little skill end up senior? There has to be more to the story.
Admin
I think you're right.
Admin
Death by parenthesis! Join me, fellow abused enclosing-thingies and have our rightous revenge now! ATTACK! Die, you ingorant fool, for you have misused us for the last time! Die twice already, come on! (Heard at The Battle Of The Parenthesis. The one who wrote this code lost the battle. And thus, the war.) (In this case. :)
Admin
Good thing they added the line breaks. I wouldn't have a clue what this did otherwise.
Admin
I can see why some people get suicidal tendencies...