Click here to Skip to main content
15,910,234 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: Padding an ID to six digits Pin
BadKarma14-Jul-08 21:41
BadKarma14-Jul-08 21:41 
GeneralRe: Padding an ID to six digits Pin
PIEBALDconsult15-Jul-08 4:39
mvePIEBALDconsult15-Jul-08 4:39 
GeneralRe: Padding an ID to six digits Pin
Ri Qen-Sin17-Jul-08 3:42
Ri Qen-Sin17-Jul-08 3:42 
GeneralRe: Padding an ID to six digits Pin
PIEBALDconsult17-Jul-08 8:38
mvePIEBALDconsult17-Jul-08 8:38 
GeneralRe: Padding an ID to six digits Pin
Paul Conrad16-Jul-08 9:15
professionalPaul Conrad16-Jul-08 9:15 
GeneralRe: Padding an ID to six digits Pin
supercat918-Jul-08 5:30
supercat918-Jul-08 5:30 
GeneralRe: Padding an ID to six digits Pin
dybs16-Aug-08 18:18
dybs16-Aug-08 18:18 
General// Enforce Method Contract Pin
Josh Smith13-Jul-08 14:05
Josh Smith13-Jul-08 14:05 
GeneralRe: // Enforce Method Contract Pin
DownUnderDev13-Jul-08 14:40
DownUnderDev13-Jul-08 14:40 
GeneralRe: // Enforce Method Contract Pin
CPallini13-Jul-08 21:10
mveCPallini13-Jul-08 21:10 
GeneralRe: // Enforce Method Contract Pin
Simon Capewell15-Jul-08 2:16
Simon Capewell15-Jul-08 2:16 
GeneralRe: // Enforce Method Contract Pin
BillW332-Sep-08 11:48
professionalBillW332-Sep-08 11:48 
GeneralRe: // Enforce Method Contract Pin
Paul Conrad14-Jul-08 7:03
professionalPaul Conrad14-Jul-08 7:03 
GeneralRe: // Enforce Method Contract Pin
Pete O'Hanlon14-Jul-08 9:07
mvePete O'Hanlon14-Jul-08 9:07 
GeneralRe: // Enforce Method Contract Pin
Josh Smith14-Jul-08 9:28
Josh Smith14-Jul-08 9:28 
GeneralRe: // Enforce Method Contract Pin
Stephen Hewitt14-Jul-08 21:31
Stephen Hewitt14-Jul-08 21:31 
GeneralRe: // Enforce Method Contract Pin
QuiJohn15-Jul-08 6:19
QuiJohn15-Jul-08 6:19 
GeneralBoolean Variable Name Pin
Daniel Kanev11-Jul-08 4:19
Daniel Kanev11-Jul-08 4:19 
GeneralRe: Boolean Variable Name PinPopular
Rage11-Jul-08 4:57
professionalRage11-Jul-08 4:57 
GeneralRe: Boolean Variable Name Pin
Daniel Kanev11-Jul-08 5:42
Daniel Kanev11-Jul-08 5:42 
GeneralRe: Boolean Variable Name Pin
Nagy Vilmos13-Jul-08 22:10
professionalNagy Vilmos13-Jul-08 22:10 
GeneralRe: Boolean Variable Name Pin
Philippe Lhoste11-Jul-08 11:10
Philippe Lhoste11-Jul-08 11:10 
GeneralRe: Boolean Variable Name Pin
killabyte11-Jul-08 14:08
killabyte11-Jul-08 14:08 
GeneralRe: Boolean Variable Name Pin
supercat914-Jul-08 6:13
supercat914-Jul-08 6:13 
GeneralRe: Boolean Variable Name Pin
CDP180221-Jul-08 2:00
CDP180221-Jul-08 2:00 
Ummm, no

I'm very fond of adding flag words to objects instead of doing something horrible like adding countless bool members. Usually they are an enumerated type and defining them in anything than hex is awkward. Like this:

// Yes, I still have the CAPITAL habit from C++
[flags]
public enum D_SOMEFLAGS : ulong
{
    // empty flag word
    NONE              = 0x0000000000000000,

    // 1 = object has been validated, 0 = object has not been validated
    VALIDATED         = 0x0000000000000001,

    // 1 = Object has been changed, 0 = object is still original
    CHANGED           = 0x0000000000000002,

    // many more...
}


But I agree that hex notation should only be used in variable names on rare occasions.

A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.

I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

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.