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

 
PraiseRe: If it fails, try again Pin
Jim_Snyder5-Jun-17 6:05
professionalJim_Snyder5-Jun-17 6:05 
GeneralRe: If it fails, try again Pin
kalberts5-Jun-17 22:06
kalberts5-Jun-17 22:06 
GeneralRe: If it fails, try again Pin
Sander Rossel6-Jun-17 5:58
professionalSander Rossel6-Jun-17 5:58 
GeneralRe: If it fails, try again Pin
Nelek6-Jun-17 6:53
protectorNelek6-Jun-17 6:53 
GeneralRe: If it fails, try again Pin
Sander Rossel6-Jun-17 11:06
professionalSander Rossel6-Jun-17 11:06 
GeneralRe: If it fails, try again Pin
Nelek6-Jun-17 19:19
protectorNelek6-Jun-17 19:19 
GeneralRe: If it fails, try again Pin
Sander Rossel6-Jun-17 21:10
professionalSander Rossel6-Jun-17 21:10 
GeneralRe: If it fails, try again Pin
kalberts7-Jun-17 1:34
kalberts7-Jun-17 1:34 
When students learn their first programming, and hopefully good programming habits, the big issue is learning the craft of programming, not the complexities of the problem solution they are set to program. So the problem solution is usually fairly simple, down to trivial. So simple that the code line says it all. The professor requires is to comment the code, but what should I write? Isn't it obvious, doesn't the code line tell? - that is common reaction from students.

You don't need comments until the problem solution is getting more complex than you can handle in the first programming course (and second, and third). The problem is so simple that the code IS obvious, and students get into the habit of writing obvious information into the comments. When they later in life get into really huge and composite data structures, intricate execution logic and complex interfaces, they are not into the habit of identifying the non-obvious, only the obvious.

When I teach people programming, I give them one rule regarding comments: Don't waste comments on what the code does, but on why it does it. Of course some students rephrased the "what" part, and I remarked: Sure, you said so in the code statement. Now tell me why you did it! - and usually, they were able to come up with a "why". That's what comments are for.
GeneralRe: If it fails, try again Pin
Rob Grainger6-Jul-17 2:12
Rob Grainger6-Jul-17 2:12 
GeneralRe: If it fails, try again PinPopular
kmoorevs5-Jun-17 4:15
kmoorevs5-Jun-17 4:15 
GeneralRe: If it fails, try again PinPopular
Sander Rossel5-Jun-17 5:29
professionalSander Rossel5-Jun-17 5:29 
GeneralRe: If it fails, try again Pin
Daniel Wilianto5-Jun-17 16:04
Daniel Wilianto5-Jun-17 16:04 
GeneralRe: If it fails, try again Pin
Rob Grainger6-Jul-17 2:20
Rob Grainger6-Jul-17 2:20 
GeneralRe: If it fails, try again Pin
DerekT-P6-Jun-17 8:37
professionalDerekT-P6-Jun-17 8:37 
GeneralRe: If it fails, try again Pin
theoldfool5-Jun-17 13:20
professionaltheoldfool5-Jun-17 13:20 
GeneralRe: If it fails, try again Pin
kalberts5-Jun-17 21:51
kalberts5-Jun-17 21:51 
GeneralRe: If it fails, try again Pin
kmoorevs6-Jun-17 4:53
kmoorevs6-Jun-17 4:53 
GeneralRe: If it fails, try again Pin
Rob Grainger6-Jul-17 2:24
Rob Grainger6-Jul-17 2:24 
GeneralRe: If it fails, try again Pin
Richard Deeming6-Jun-17 0:20
mveRichard Deeming6-Jun-17 0:20 
GeneralRe: If it fails, try again Pin
abmv23-Jun-17 9:14
professionalabmv23-Jun-17 9:14 
GeneralPetrovich Pin
Brisingr Aerowing15-May-17 11:54
professionalBrisingr Aerowing15-May-17 11:54 
PraiseRe: Petrovich Pin
Marco Bertschi15-May-17 12:30
protectorMarco Bertschi15-May-17 12:30 
PraiseRe: Petrovich Pin
enhzflep25-May-17 23:23
enhzflep25-May-17 23:23 
GeneralVery WTF worthy Mass Effect bug Pin
Brisingr Aerowing6-May-17 14:02
professionalBrisingr Aerowing6-May-17 14:02 
GeneralRe: Very WTF worthy Mass Effect bug Pin
Nathan Minier8-May-17 2:08
professionalNathan Minier8-May-17 2:08 

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.