Click here to Skip to main content
15,900,461 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.

 
AnswerRe: Finding a record by its primary key Pin
Dan Neely26-Aug-08 2:19
Dan Neely26-Aug-08 2:19 
GeneralRe: Finding a record by its primary key Pin
Paul Conrad22-Aug-08 9:36
professionalPaul Conrad22-Aug-08 9:36 
GeneralRe: Finding a record by its primary key Pin
SilimSayo25-Aug-08 3:52
SilimSayo25-Aug-08 3:52 
GeneralRe: Finding a record by its primary key Pin
Nathan Tuggy25-Aug-08 8:45
Nathan Tuggy25-Aug-08 8:45 
GeneralRe: Finding a record by its primary key Pin
Nathan Tuggy25-Aug-08 8:46
Nathan Tuggy25-Aug-08 8:46 
GeneralRe: Finding a record by its primary key Pin
CDP180228-Aug-08 4:37
CDP180228-Aug-08 4:37 
Generali cant believe its not butter...or that i wrote this Pin
SomeGuyThatIsMe18-Aug-08 3:42
SomeGuyThatIsMe18-Aug-08 3:42 
Generalwho wrote wrote this C program? PinPopular
Steven A. Lowe17-Aug-08 18:22
Steven A. Lowe17-Aug-08 18:22 
Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it?

What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates.

The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes.

So I started looking at the code...and found several interesting things:

  • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
  • every variable was global
  • there were no data structures anywhere for anything
  • there were no functions other than those required by the GUI
  • several functions were over 75 pages long - that's about 4500 lines of code in a single function
  • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function


Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story].

My curiosity could not be held back, I had to know who had written this program...

This program was written by a COBOL programmer. It was her first C program, and her first GUI program.

I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

Best regards,
Steven A. Lowe
CEO, Innovator LLC
www.nov8r.com

JokeRe: who wrote wrote this C program? PinPopular
darkelv17-Aug-08 19:47
darkelv17-Aug-08 19:47 
GeneralRe: who wrote wrote this C program? Pin
Vimalsoft(Pty) Ltd24-Aug-08 4:01
professionalVimalsoft(Pty) Ltd24-Aug-08 4:01 
GeneralRe: who wrote wrote this C program? PinPopular
QuiJohn19-Aug-08 3:03
QuiJohn19-Aug-08 3:03 
GeneralRe: who wrote wrote this C program? Pin
Mladen Janković19-Aug-08 3:09
Mladen Janković19-Aug-08 3:09 
GeneralRe: who wrote wrote this C program? Pin
Dan Neely19-Aug-08 7:25
Dan Neely19-Aug-08 7:25 
GeneralRe: who wrote wrote this C program? Pin
Yusuf19-Aug-08 8:48
Yusuf19-Aug-08 8:48 
GeneralRe: who wrote wrote this C program? Pin
mattraffel22-Aug-08 8:36
mattraffel22-Aug-08 8:36 
GeneralRe: who wrote wrote this C program? Pin
BillW333-Sep-08 11:21
professionalBillW333-Sep-08 11:21 
GeneralRe: who wrote wrote this C program? Pin
Paul Conrad21-Aug-08 16:50
professionalPaul Conrad21-Aug-08 16:50 
JokeRan across this sql the other day. Pin
Austin Harris15-Aug-08 8:44
Austin Harris15-Aug-08 8:44 
GeneralRe: Ran across this sql the other day. Pin
Pete O'Hanlon15-Aug-08 8:54
mvePete O'Hanlon15-Aug-08 8:54 
GeneralRe: Ran across this sql the other day. Pin
PIEBALDconsult15-Aug-08 12:06
mvePIEBALDconsult15-Aug-08 12:06 
GeneralRe: Ran across this sql the other day. Pin
Brent Lamborn15-Aug-08 9:32
Brent Lamborn15-Aug-08 9:32 
GeneralRe: Ran across this sql the other day. Pin
Paul Conrad16-Aug-08 5:52
professionalPaul Conrad16-Aug-08 5:52 
GeneralRe: Ran across this sql the other day. Pin
Yusuf16-Aug-08 17:27
Yusuf16-Aug-08 17:27 
GeneralRe: Ran across this sql the other day. Pin
Mike Dimmick17-Aug-08 10:17
Mike Dimmick17-Aug-08 10:17 
GeneralPractice safe programming ! Pin
User 4041112-Aug-08 23:13
User 4041112-Aug-08 23:13 

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.