Click here to Skip to main content
15,917,321 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: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 9:37
cpkilekofp25-Sep-08 9:37 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt25-Sep-08 9:41
leonej_dt25-Sep-08 9:41 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 10:16
cpkilekofp25-Sep-08 10:16 
JokeRe: To me this is a coding horror, and to you? Pin
leonej_dt25-Sep-08 10:19
leonej_dt25-Sep-08 10:19 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 10:25
cpkilekofp25-Sep-08 10:25 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt25-Sep-08 10:56
leonej_dt25-Sep-08 10:56 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp29-Sep-08 4:03
cpkilekofp29-Sep-08 4:03 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt29-Sep-08 17:49
leonej_dt29-Sep-08 17:49 
cpkilekofp wrote:
4. The code must be readable by someone with no more than six months of experience.


My code might not always be readable by someone with little experience, but...

cpkilekofp wrote:
5. The code must be modifiable and extendable without a major rewrite.


... even when I'm doing low-level stuff, I take enough care to ensure the logic of the program can be understood. [Edit starts here] If comments are not enough, I document what I'm doing, both the mathematical proof of correctness and the actual algorithm, step by step. [Edit ends here]

cpkilekofp wrote:
is a C# example, not a C example.


Excuse me, sir. You are wrong. The IS_NOT_ZERO macro is a C example, not a C# one. You can't apply the ! operator to an integer in C#. You can do that in C.

cpkilekofp wrote:
It is, however, a cowboy trick, and if I found it in a review of your C# code, you'd be fixing it the next day.


The IS_NOT_ZERO macro was a joke. I was making fun of people who can't understand what !! does to an integer.

cpkilekofp wrote:
that you can write everything in obscure C with no indentation and the next programmer will be able to read it at a glance.


I may be a cowboy coder, but I always indent my code. If my code is not clear, that might have been the result of

a) intentional obfuscation
b) not so obvious optimization

In either case, I document what I'm doing.

If you can play The Dance of Eternity (Dream Theater), then we shall make a band.

GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp30-Sep-08 7:00
cpkilekofp30-Sep-08 7:00 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt1-Oct-08 15:18
leonej_dt1-Oct-08 15:18 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp2-Oct-08 5:49
cpkilekofp2-Oct-08 5:49 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp2-Oct-08 7:03
cpkilekofp2-Oct-08 7:03 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs2-Oct-08 10:34
geoffs2-Oct-08 10:34 
GeneralRe: To me this is a coding horror, and to you? Pin
David St. Hilaire24-Sep-08 14:01
David St. Hilaire24-Sep-08 14:01 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 3:49
cpkilekofp25-Sep-08 3:49 
GeneralSomeone please help me .... PinPopular
Monty211-Sep-08 18:27
Monty211-Sep-08 18:27 
GeneralRe: Someone please help me .... Pin
StM0n11-Sep-08 23:45
StM0n11-Sep-08 23:45 
JokeRe: Someone please help me .... Pin
BadKarma11-Sep-08 23:58
BadKarma11-Sep-08 23:58 
GeneralRe: Someone please help me .... Pin
dojohansen16-Sep-08 2:22
dojohansen16-Sep-08 2:22 
GeneralRe: Someone please help me .... Pin
cpkilekofp25-Sep-08 3:58
cpkilekofp25-Sep-08 3:58 
GeneralRe: Someone please help me .... Pin
Nagy Vilmos12-Sep-08 2:26
professionalNagy Vilmos12-Sep-08 2:26 
JokeRe: Someone please help me .... Pin
Chris Meech12-Sep-08 2:39
Chris Meech12-Sep-08 2:39 
JokeRe: Someone please help me .... Pin
CPallini12-Sep-08 3:35
mveCPallini12-Sep-08 3:35 
GeneralRe: Someone please help me .... Pin
dojohansen16-Sep-08 2:24
dojohansen16-Sep-08 2:24 
GeneralRe: Someone please help me .... Pin
CPallini16-Sep-08 2:30
mveCPallini16-Sep-08 2:30 

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.