Click here to Skip to main content
15,897,226 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: Classic Pin
Tom Clement30-Jul-07 13:07
professionalTom Clement30-Jul-07 13:07 
GeneralRe: Classic Pin
TClarke31-Jul-07 0:12
TClarke31-Jul-07 0:12 
GeneralRe: Classic Pin
kenpanda31-Jul-07 1:30
kenpanda31-Jul-07 1:30 
GeneralRe: Classic Pin
dojohansen20-Aug-07 2:20
dojohansen20-Aug-07 2:20 
GeneralRe: Classic Pin
dojohansen20-Aug-07 2:26
dojohansen20-Aug-07 2:26 
GeneralRe: Classic Pin
Chris Losinger24-Jul-07 7:04
professionalChris Losinger24-Jul-07 7:04 
GeneralRe: Classic == false Pin
Andy Brummer24-Jul-07 7:41
sitebuilderAndy Brummer24-Jul-07 7:41 
GeneralRe: Classic == false Pin
dojohansen20-Aug-07 2:33
dojohansen20-Aug-07 2:33 
It stands out more?? How clear do you need it to be?

IMO, (b == true) "stands out" more than (b), so if this was a guiding principle we ought to write it all the time.

Perhaps we should also write

int i, count, n;
...
i = i.Add(count.Multiply(n));

instead of

i += count * n;


Admittedly the last example is a stretch. And the issue is surely quite academical - there are a few other bad coding habits I can think of, and methodology (or lack thereof), and much else, that matters rather a lot more in the end. But for the sake of academic nitpicking (which I think is rather fun) I'd still say "less is usually better". The only exception is when less code makes something obscure or unreadable. In my judgement (!b) clearly does NOT qualify; it is as clear as it can be.
GeneralRe: Classic Pin
Pete O'Hanlon24-Jul-07 22:49
mvePete O'Hanlon24-Jul-07 22:49 
GeneralRe: Classic Pin
Luis Alonso Ramos25-Jul-07 19:07
Luis Alonso Ramos25-Jul-07 19:07 
GeneralRe: Classic Pin
Vasudevan Deepak Kumar26-Jul-07 22:53
Vasudevan Deepak Kumar26-Jul-07 22:53 
GeneralRe: Classic Pin
Luis Alonso Ramos27-Jul-07 5:28
Luis Alonso Ramos27-Jul-07 5:28 
GeneralRe: Classic Pin
dean.wilde9-Aug-07 12:40
dean.wilde9-Aug-07 12:40 
Generaltypeof(string)? Meh. Pin
DavidNohejl23-Jul-07 5:59
DavidNohejl23-Jul-07 5:59 
GeneralRe: typeof(string)? Meh. Pin
PIEBALDconsult23-Jul-07 8:27
mvePIEBALDconsult23-Jul-07 8:27 
GeneralRe: typeof(string)? Meh. Pin
DavidNohejl23-Jul-07 8:32
DavidNohejl23-Jul-07 8:32 
GeneralRe: typeof(string)? Meh. Pin
PIEBALDconsult23-Jul-07 8:37
mvePIEBALDconsult23-Jul-07 8:37 
GeneralRe: typeof(string)? Meh. Pin
Paul Conrad23-Jul-07 12:11
professionalPaul Conrad23-Jul-07 12:11 
GeneralRe: typeof(string)? Meh. Pin
Andy Brummer23-Jul-07 8:46
sitebuilderAndy Brummer23-Jul-07 8:46 
GeneralRe: typeof(string)? Meh. Pin
dojohansen20-Aug-07 2:51
dojohansen20-Aug-07 2:51 
GeneralRe: typeof(string)? Meh. Pin
PaulPrice23-Jul-07 9:59
PaulPrice23-Jul-07 9:59 
GeneralRe: typeof(string)? Meh. Pin
DavidNohejl23-Jul-07 12:09
DavidNohejl23-Jul-07 12:09 
GeneralRe: typeof(string)? Meh. Pin
PaulPrice23-Jul-07 12:55
PaulPrice23-Jul-07 12:55 
GeneralRe: typeof(string)? Meh. Pin
Vasudevan Deepak Kumar28-Jul-07 22:15
Vasudevan Deepak Kumar28-Jul-07 22:15 
GeneralRe: typeof(string)? Meh. Pin
Paul Conrad23-Jul-07 12:12
professionalPaul Conrad23-Jul-07 12:12 

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.