Click here to Skip to main content
15,921,156 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: Strong Typing Pin
Chris Maunder8-May-07 7:45
cofounderChris Maunder8-May-07 7:45 
GeneralRe: Strong Typing Pin
XTAL25611-May-07 2:33
XTAL25611-May-07 2:33 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 2:45
Tristan Rhodes8-May-07 2:45 
GeneralRe: Strong Typing Pin
Marcus J. Smith8-May-07 2:48
professionalMarcus J. Smith8-May-07 2:48 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 6:46
Tristan Rhodes8-May-07 6:46 
GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 7:34
mvePIEBALDconsult8-May-07 7:34 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 8:19
Tristan Rhodes8-May-07 8:19 
GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 9:37
mvePIEBALDconsult8-May-07 9:37 
Makes sense to me.

A similar thing I do is with ExecuteScalar(), which returns object which then (usually) requires a test for null and a cast, and setting a default value if null. I wrote a wrapper like public virtual T ExecuteScalar<T>(T IfNull){...} to handle the cast. Any time I'm writing a scalar query and don't have to test for null and/or do a cast I save time, the code is more readable too.

Usually, spending the time to encapsulate such common tasks will pay off.

"A stitch in time saves nine."
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 9:43
Tristan Rhodes8-May-07 9:43 
GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 11:38
mvePIEBALDconsult8-May-07 11:38 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 22:31
Tristan Rhodes8-May-07 22:31 
GeneralRe: Strong Typing Pin
PIEBALDconsult9-May-07 17:13
mvePIEBALDconsult9-May-07 17:13 
GeneralRe: Strong Typing Pin
Marcus J. Smith8-May-07 8:11
professionalMarcus J. Smith8-May-07 8:11 
GeneralRe: Strong Typing Pin
urbane.tiger7-May-07 20:44
urbane.tiger7-May-07 20:44 
GeneralReusable Code Pin
kin3tik3-May-07 9:31
kin3tik3-May-07 9:31 
GeneralRe: Reusable Code Pin
PIEBALDconsult3-May-07 11:57
mvePIEBALDconsult3-May-07 11:57 
AnswerRe: Reusable Code Pin
DavidNohejl3-May-07 12:29
DavidNohejl3-May-07 12:29 
GeneralRe: Reusable Code Pin
Rob Graham3-May-07 12:43
Rob Graham3-May-07 12:43 
GeneralRe: Reusable Code Pin
PIEBALDconsult3-May-07 13:58
mvePIEBALDconsult3-May-07 13:58 
GeneralRe: Reusable Code Pin
kin3tik3-May-07 19:56
kin3tik3-May-07 19:56 
GeneralRe: Reusable Code Pin
PIEBALDconsult5-May-07 6:00
mvePIEBALDconsult5-May-07 6:00 
GeneralRe: Reusable Code Pin
Sylvester george20-Jun-07 3:12
Sylvester george20-Jun-07 3:12 
GeneralThis is just beautiful! Pin
jchigg20001-May-07 5:59
jchigg20001-May-07 5:59 
GeneralRe: This is just beautiful! Pin
CPallini1-May-07 7:46
mveCPallini1-May-07 7:46 
GeneralRe: This is just beautiful! Pin
Pete O'Hanlon1-May-07 10:06
mvePete O'Hanlon1-May-07 10:06 

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.