The Weird and The Wonderful
The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.
We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.
Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.
|This code (sanitized):
static public void PostSomeCodeMethod(string v1, string v2, string v3)
string xmldata = iRecord.CreateField("apicode", APICodes.SomeCode.ToString());
xmldata += iRecord.CreateField("f1", const1);
xmldata += iRecord.CreateField("f2", const2);
xmldata += iRecord.CreateField("f3", v1);
xmldata += iRecord.CreateField("f4", v2);
xmldata += iRecord.CreateField("f5", v3);
ErrorMessage = null;
Is duplicated a dozen times. The only difference? The method name and the APICodes enumeration.
I swear, copy and paste should be banned, and there must be something we can put into the water that prevents programmers like this from ever writing another line of code.
(Not to mention the horrific way the XML data is created. Happy belated Halloween, everyone.)
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Copyright © CodeProject
All Rights Reserved.