Click here to Skip to main content
15,887,175 members

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.

 
GeneralRe: top this Pin
hohums23-Aug-10 21:37
hohums23-Aug-10 21:37 
GeneralRe: top this Pin
Yusuf4-Aug-10 13:30
Yusuf4-Aug-10 13:30 
GeneralRe: top this Pin
Chris Boden3-Aug-10 9:45
Chris Boden3-Aug-10 9:45 
GeneralRe: top this Pin
Jeroen De Dauw3-Aug-10 12:35
Jeroen De Dauw3-Aug-10 12:35 
GeneralRe: top this Pin
PIEBALDconsult3-Aug-10 15:28
mvePIEBALDconsult3-Aug-10 15:28 
GeneralRe: top this Pin
Joe Programm3r3-Aug-10 15:49
Joe Programm3r3-Aug-10 15:49 
GeneralRe: top this Pin
SirTimothy3-Aug-10 16:08
SirTimothy3-Aug-10 16:08 
GeneralRe: top this [modified] PinPopular
CDP18023-Aug-10 22:32
CDP18023-Aug-10 22:32 
This is easy to top, even if I can't post the code here for several reasons.

Immagine this:

- A source file with a class
- All methods are static, so this is not really much of a class
- The whole thing has about 7000 lines
- The methods are more or less the application logic and data access for the entire application
- Some methods are redundant, possible differences to the other versions are not apparent or documented.
- To be precise: Nothing is commented except the many WTFs of the poor guys who tried to maintain that thing.
- Several methods consist of 500+ lines of real spaghetti code
- No error handling except for a few empty catch blocks
- The few catch blocks that are not empty try to send meaningless or even misleading mails to the responsible developer
- No apparent naming convention for variables except that the names usually are cryptic or misleading. On top of that a generous measure of German has been thrown in to make the code more readable.
- The application (a ASP .Net website) has no such thing as layers. Everything was thrown into this 'class' as static methods.
- One of the static methods (which also has two redundant copies which may have some significant changes - or not) tries to replace the entire data access layer. It takes about two dozen parameters and then tries to construct the required SQL command in about 500 lines of twisted code. Changes are next to impossible without side effects as each snippet of code is used to construct very different SQL statements. If nested select statements are needed, they are constructed in similar static functions.
- Once all SQL commands has been constructed, data access is done in the following fashion: First, a simple sql command is issued to get a DataSet as a result. The DataLines are then thrown away. The 'Developer' was just to lazy to initialize the DataSet the normal way. Then the thing tries to fill all tables in the DataSet with the prepared SQL commands, each table separately. If there is no error (a rare event), the whole thing is finished by declaring about 30 relations between the tables in the DataSet. This usually is the end of it, as the generated SQL commands usually do not fill the table precisely enough to enforce any constraints or relations.

This thing has nothing, no architecture, no class design, no readability, no maintainability. It is the ultimate coding horror. It is really the first piece of code I ever had to work with where I say that the 'developer' got nothing right. Not the least bit and not even by random luck.
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.

modified on Wednesday, August 4, 2010 4:41 AM

GeneralRe: top this Pin
imagiro4-Aug-10 4:50
imagiro4-Aug-10 4:50 
GeneralRe: top this Pin
CDP18024-Aug-10 21:08
CDP18024-Aug-10 21:08 
GeneralRe: top this Pin
imagiro5-Aug-10 1:05
imagiro5-Aug-10 1:05 
GeneralRe: top this Pin
CDP18025-Aug-10 1:11
CDP18025-Aug-10 1:11 
GeneralRe: top this Pin
Michael Eber10-Aug-10 9:09
Michael Eber10-Aug-10 9:09 
JokeRe: top this Pin
Yusuf4-Aug-10 13:31
Yusuf4-Aug-10 13:31 
GeneralRe: top this Pin
CDP18024-Aug-10 21:20
CDP18024-Aug-10 21:20 
GeneralRe: top this Pin
mr_lasseter8-Aug-10 3:55
mr_lasseter8-Aug-10 3:55 
GeneralRe: top this Pin
CDP18028-Aug-10 20:56
CDP18028-Aug-10 20:56 
GeneralRe: top this Pin
Richard A. Dalton12-Aug-10 0:26
Richard A. Dalton12-Aug-10 0:26 
GeneralRe: top this Pin
CDP180212-Aug-10 0:35
CDP180212-Aug-10 0:35 
GeneralRe: top this Pin
Richard A. Dalton12-Aug-10 1:03
Richard A. Dalton12-Aug-10 1:03 
GeneralRe: top this Pin
CDP180212-Aug-10 1:36
CDP180212-Aug-10 1:36 
GeneralRe: top this Pin
Richard A. Dalton12-Aug-10 5:16
Richard A. Dalton12-Aug-10 5:16 
GeneralRe: top this Pin
Yusuf4-Aug-10 13:32
Yusuf4-Aug-10 13:32 
GeneralRe: top this Pin
bleedingfingers4-Aug-10 21:41
bleedingfingers4-Aug-10 21:41 
GeneralRe: top this Pin
devvvy5-Aug-10 15:57
devvvy5-Aug-10 15:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.