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: When I say I am going to do a thing... Pin
OriginalGriff18-Jun-14 8:58
mveOriginalGriff18-Jun-14 8:58 
GeneralRe: When I say I am going to do a thing... Pin
Jörgen Andersson18-Jun-14 20:37
professionalJörgen Andersson18-Jun-14 20:37 
GeneralRe: When I say I am going to do a thing... Pin
Nagy Vilmos18-Jun-14 21:36
professionalNagy Vilmos18-Jun-14 21:36 
GeneralRe: When I say I am going to do a thing... Pin
Richard Deeming19-Jun-14 1:30
mveRichard Deeming19-Jun-14 1:30 
GeneralRe: When I say I am going to do a thing... Pin
cpkilekofp19-Jun-14 7:25
cpkilekofp19-Jun-14 7:25 
GeneralRe: When I say I am going to do a thing... Pin
Bernhard Hiller19-Jun-14 22:32
Bernhard Hiller19-Jun-14 22:32 
GeneralInteresting boolean technique PinPopular
Dan Neely16-Jun-14 8:08
Dan Neely16-Jun-14 8:08 
GeneralRe: Interesting boolean technique Pin
Marc Clifton16-Jun-14 8:14
mvaMarc Clifton16-Jun-14 8:14 
Dan Neely wrote:
8 years ago I apparently thought I was being clever by having an empty then block and only having actual code in the else branch.


Well, in Ruby, you could write:

unless (e.Message.StartsWith(.....

which I find even more baffling linguistically. I always have to mentally change that to "if not..."

Or worse (because the conditional comes at the end, and in one case I never saw the conditional because it was off-screen on a very long line), but better linguistically:

errorToDisplay += "\n" + e.Message unless e.Message.StartsWith("Case we don't care about")


Why do I bring this up? Because idiomitic Ruby frowns on negative conditions, like "if !".

Personally, there is a lot of idiomatic Ruby that I refuse to use because it just seems idiotic, not idiomatic.

Marc
Latest Article - APOD Scraper

GeneralRe: Interesting boolean technique Pin
Dan Neely16-Jun-14 8:21
Dan Neely16-Jun-14 8:21 
GeneralRe: Interesting boolean technique Pin
DaveAuld16-Jun-14 8:55
professionalDaveAuld16-Jun-14 8:55 
GeneralRe: Interesting boolean technique Pin
harold aptroot16-Jun-14 22:21
harold aptroot16-Jun-14 22:21 
GeneralRe: Interesting boolean technique Pin
BillW3316-Jun-14 9:11
professionalBillW3316-Jun-14 9:11 
GeneralRe: Interesting boolean technique Pin
Deflinek16-Jun-14 9:53
Deflinek16-Jun-14 9:53 
GeneralRe: Interesting boolean technique Pin
PIEBALDconsult16-Jun-14 11:11
mvePIEBALDconsult16-Jun-14 11:11 
GeneralRe: Interesting boolean technique Pin
Bernhard Hiller16-Jun-14 21:18
Bernhard Hiller16-Jun-14 21:18 
GeneralRe: Interesting boolean technique Pin
OriginalGriff17-Jun-14 5:38
mveOriginalGriff17-Jun-14 5:38 
JokeRe: Interesting boolean technique PinPopular
PaulLinton17-Jun-14 19:49
PaulLinton17-Jun-14 19:49 
GeneralRe: Interesting boolean technique Pin
Bernhard Hiller17-Jun-14 21:42
Bernhard Hiller17-Jun-14 21:42 
GeneralRe: Interesting boolean technique Pin
Super Lloyd18-Jun-14 20:28
Super Lloyd18-Jun-14 20:28 
GeneralInteresting technique used in some Legacy code! Pin
DeathByChocolate16-Jun-14 3:52
professionalDeathByChocolate16-Jun-14 3:52 
GeneralRe: Interesting technique used in some Legacy code! Pin
Nagy Vilmos16-Jun-14 3:56
professionalNagy Vilmos16-Jun-14 3:56 
GeneralRe: Interesting technique used in some Legacy code! Pin
DeathByChocolate16-Jun-14 4:02
professionalDeathByChocolate16-Jun-14 4:02 
GeneralRe: Interesting technique used in some Legacy code! Pin
Kornfeld Eliyahu Peter16-Jun-14 4:01
professionalKornfeld Eliyahu Peter16-Jun-14 4:01 
GeneralRe: Interesting technique used in some Legacy code! Pin
DeathByChocolate16-Jun-14 4:22
professionalDeathByChocolate16-Jun-14 4:22 
GeneralRe: Interesting technique used in some Legacy code! Pin
Kornfeld Eliyahu Peter16-Jun-14 4:25
professionalKornfeld Eliyahu Peter16-Jun-14 4:25 

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.