Click here to Skip to main content
15,888,351 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: Is this a coding horror? Pin
BloodyBaron30-Aug-11 22:21
BloodyBaron30-Aug-11 22:21 
GeneralRe: Is this a coding horror? Pin
GibbleCH31-Aug-11 3:56
GibbleCH31-Aug-11 3:56 
GeneralRe: Is this a coding horror? Pin
BobJanova31-Aug-11 0:03
BobJanova31-Aug-11 0:03 
GeneralRe: Is this a coding horror? Pin
Rob Grainger6-Sep-11 0:58
Rob Grainger6-Sep-11 0:58 
GeneralRe: Is this a coding horror? Pin
Eusebiu Marcu30-Aug-11 2:46
Eusebiu Marcu30-Aug-11 2:46 
GeneralRe: Is this a coding horror? Pin
BobJanova30-Aug-11 2:51
BobJanova30-Aug-11 2:51 
GeneralRe: Is this a coding horror? Pin
BobJanova30-Aug-11 2:47
BobJanova30-Aug-11 2:47 
GeneralRe: Is this a coding horror? Pin
BubingaMan30-Aug-11 3:03
BubingaMan30-Aug-11 3:03 
I don't think it's that bad tbh. Can it improve? Probably.

I'ld say that possible improvements could be:
1. rename the method to reflect the 'if' logic
2. extract the 'if' logic so that this method indeed does nothing but add a role to a specific list of roles
3. refactor it into 2 methods.

Also, looking at this small piece of code only, I spot a possible unhandled nullreference Smile | :)
But that's probably resharper being hardwired into my brain. :-S

Anyhow, if I were to do a code review and come accross this, I probably wouldn't get all fired up about it. So, no, it's certainly not a "horror".

It's actually quite elegant imo.
The 3 points above are just nitpicking (which is something you can do with almost any piece of code).
GeneralRe: Is this a coding horror? Pin
Vlad Krivoroutchko30-Aug-11 3:11
Vlad Krivoroutchko30-Aug-11 3:11 
GeneralRe: Is this a coding horror? Pin
BubingaMan30-Aug-11 3:17
BubingaMan30-Aug-11 3:17 
GeneralRe: Is this a coding horror? Pin
ii_noname_ii30-Aug-11 3:37
ii_noname_ii30-Aug-11 3:37 
GeneralRe: Is this a coding horror? Pin
Stefan_Lang30-Aug-11 3:49
Stefan_Lang30-Aug-11 3:49 
GeneralRe: Is this a coding horror? Pin
IAbstract30-Aug-11 4:13
IAbstract30-Aug-11 4:13 
GeneralRe: Is this a coding horror? Pin
Schmuli30-Aug-11 23:10
Schmuli30-Aug-11 23:10 
GeneralRe: Is this a coding horror? Pin
IAbstract31-Aug-11 1:27
IAbstract31-Aug-11 1:27 
GeneralRe: Is this a coding horror? Pin
Jim (SS)30-Aug-11 6:06
Jim (SS)30-Aug-11 6:06 
GeneralRe: Is this a coding horror? Pin
Kenneth Kasajian30-Aug-11 9:10
Kenneth Kasajian30-Aug-11 9:10 
GeneralRe: Is this a coding horror? Pin
OriginalGriff30-Aug-11 9:19
mveOriginalGriff30-Aug-11 9:19 
GeneralRe: Is this a coding horror? Pin
Kenneth Kasajian30-Aug-11 19:13
Kenneth Kasajian30-Aug-11 19:13 
GeneralRe: Is this a coding horror? Pin
OriginalGriff30-Aug-11 21:43
mveOriginalGriff30-Aug-11 21:43 
GeneralRe: Is this a coding horror? Pin
BobJanova30-Aug-11 23:07
BobJanova30-Aug-11 23:07 
GeneralRe: Is this a coding horror? Pin
Tech Code Freak30-Aug-11 20:30
Tech Code Freak30-Aug-11 20:30 
GeneralRe: Is this a coding horror? Pin
Tom Chantler1-Sep-11 3:06
professionalTom Chantler1-Sep-11 3:06 
GeneralRe: Is this a coding horror? Pin
thoiness1-Sep-11 5:14
thoiness1-Sep-11 5:14 
GeneralTryParse - you should Try understanding!!! Pin
VallarasuS26-Aug-11 21:17
VallarasuS26-Aug-11 21:17 

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.