Click here to Skip to main content
15,884,176 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: It's the small things that matter. Pin
fjdiewornncalwe29-Oct-10 4:08
professionalfjdiewornncalwe29-Oct-10 4:08 
GeneralIt's not the most obvious piece of logic. PinPopular
Pete O'Hanlon22-Oct-10 11:51
mvePete O'Hanlon22-Oct-10 11:51 
GeneralRe: It's not the most obvious piece of logic. Pin
AspDotNetDev22-Oct-10 12:10
protectorAspDotNetDev22-Oct-10 12:10 
GeneralRe: It's not the most obvious piece of logic. Pin
Pete O'Hanlon23-Oct-10 0:50
mvePete O'Hanlon23-Oct-10 0:50 
GeneralRe: It's not the most obvious piece of logic. Pin
Peter_in_278022-Oct-10 12:20
professionalPeter_in_278022-Oct-10 12:20 
GeneralRe: It's not the most obvious piece of logic. Pin
PIEBALDconsult22-Oct-10 16:52
mvePIEBALDconsult22-Oct-10 16:52 
GeneralRe: It's not the most obvious piece of logic. Pin
harold aptroot23-Oct-10 11:04
harold aptroot23-Oct-10 11:04 
GeneralRe: It's not the most obvious piece of logic. Pin
Xiangyang Liu 刘向阳23-Oct-10 5:42
Xiangyang Liu 刘向阳23-Oct-10 5:42 
Pete O'Hanlon wrote:
if (!(value > 0)){ throw new ArgumentOutOfRangeException("....");}
Could we not do this?
if (value <= 0)


There could be a perfectly reasonable explanation: The code maybe like the following previously

<br />
if (!isValid(value)){  throw new ArgumentOutOfRangeException("....");}<br />


Then someone decided to simplify it by replacing isValid(value) with (value>0).

GeneralRe: It's not the most obvious piece of logic. Pin
Pete O'Hanlon23-Oct-10 10:09
mvePete O'Hanlon23-Oct-10 10:09 
GeneralRe: It's not the most obvious piece of logic. Pin
fjdiewornncalwe24-Oct-10 6:47
professionalfjdiewornncalwe24-Oct-10 6:47 
GeneralRe: It's not the most obvious piece of logic. Pin
BillW3325-Oct-10 7:50
professionalBillW3325-Oct-10 7:50 
GeneralRe: It's not the most obvious piece of logic. Pin
Thomas Vanderhoof26-Oct-10 3:02
professionalThomas Vanderhoof26-Oct-10 3:02 
GeneralRe: It's not the most obvious piece of logic. Pin
James Lonero27-Oct-10 10:51
James Lonero27-Oct-10 10:51 
GeneralRe: It's not the most obvious piece of logic. Pin
supercat925-Oct-10 12:21
supercat925-Oct-10 12:21 
GeneralRe: It's not the most obvious piece of logic. PinPopular
normanS25-Oct-10 20:59
normanS25-Oct-10 20:59 
GeneralRe: It's not the most obvious piece of logic. Pin
Super Lloyd25-Oct-10 22:49
Super Lloyd25-Oct-10 22:49 
GeneralRe: It's not the most obvious piece of logic. Pin
Thomas Vanderhoof26-Oct-10 3:07
professionalThomas Vanderhoof26-Oct-10 3:07 
GeneralRe: It's not the most obvious piece of logic. Pin
Super Lloyd26-Oct-10 4:01
Super Lloyd26-Oct-10 4:01 
JokeRe: It's not the most obvious piece of logic. Pin
Jyothikarthik_N26-Dec-10 19:13
Jyothikarthik_N26-Dec-10 19:13 
GeneralRe: It's not the most obvious piece of logic. Pin
Jeff Connelly26-Oct-10 4:57
Jeff Connelly26-Oct-10 4:57 
GeneralRe: It's not the most obvious piece of logic. Pin
KChandos26-Oct-10 6:39
professionalKChandos26-Oct-10 6:39 
GeneralRe: It's not the most obvious piece of logic. Pin
Pete O'Hanlon26-Oct-10 9:43
mvePete O'Hanlon26-Oct-10 9:43 
GeneralRe: It's not the most obvious piece of logic. Pin
Richard Deeming26-Oct-10 7:54
mveRichard Deeming26-Oct-10 7:54 
GeneralRe: It's not the most obvious piece of logic. Pin
Pete O'Hanlon26-Oct-10 9:44
mvePete O'Hanlon26-Oct-10 9:44 
GeneralRe: It's not the most obvious piece of logic. Pin
FrankLaPiana26-Oct-10 8:44
FrankLaPiana26-Oct-10 8:44 

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.