Click here to Skip to main content
15,886,919 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: loops and stuff Pin
Brisingr Aerowing2-Aug-16 3:42
professionalBrisingr Aerowing2-Aug-16 3:42 
GeneralBecause Reasons Pin
loctrice19-Jul-16 4:40
professionalloctrice19-Jul-16 4:40 
GeneralRe: Because Reasons PinPopular
Wonde Tadesse19-Jul-16 4:47
professionalWonde Tadesse19-Jul-16 4:47 
GeneralRe: Because Reasons Pin
Richard Deeming19-Jul-16 4:48
mveRichard Deeming19-Jul-16 4:48 
GeneralRe: Because Reasons PinPopular
Duncan Edwards Jones19-Jul-16 5:31
professionalDuncan Edwards Jones19-Jul-16 5:31 
GeneralRe: Because Reasons Pin
Super Lloyd30-Jul-16 4:12
Super Lloyd30-Jul-16 4:12 
GeneralRe: Because Reasons Pin
loctrice19-Jul-16 5:53
professionalloctrice19-Jul-16 5:53 
GeneralRe: Because Reasons Pin
Sander Rossel19-Jul-16 6:27
professionalSander Rossel19-Jul-16 6:27 
I once used a marker interface for some third party component.
The component COULD edit, save, cancel, delete, etc. (through a method named DoAction(string)). If an action was supported was decided by some method ActionSupported(string) or some such.
I created an empty marker interface IThirdPartyComponent, and then interfaces like ISave (with Save method), IEdit (with Edit method) etc. that all inherited IThirdPartyComponent.
That worked a lot better than DoAction(string) and ActionSupported(string), especially since I was able to built some strong typed additional tooling around it Smile | :)
Read my (free) ebook Object-Oriented Programming in C# Succinctly.
Visit my blog at Sander's bits - Writing the code you need.
Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability.
— Edsger W. Dijkstra
Regards,
Sander

GeneralRe: Because Reasons Pin
loctrice19-Jul-16 8:50
professionalloctrice19-Jul-16 8:50 
GeneralRe: Because Reasons Pin
Brisingr Aerowing31-Jul-16 14:39
professionalBrisingr Aerowing31-Jul-16 14:39 
GeneralRe: Because Reasons Pin
Sander Rossel31-Jul-16 21:14
professionalSander Rossel31-Jul-16 21:14 
GeneralRe: Because Reasons Pin
Brisingr Aerowing1-Aug-16 5:40
professionalBrisingr Aerowing1-Aug-16 5:40 
GeneralRe: Because Reasons Pin
Sander Rossel1-Aug-16 21:43
professionalSander Rossel1-Aug-16 21:43 
GeneralRe: Because Reasons Pin
Brisingr Aerowing4-Sep-16 18:16
professionalBrisingr Aerowing4-Sep-16 18:16 
GeneralRe: Because Reasons Pin
johannesnestler26-Jul-16 1:34
johannesnestler26-Jul-16 1:34 
GeneralRe: Because Reasons Pin
Ravichanadeepakarandescarar29-Jul-16 16:03
Ravichanadeepakarandescarar29-Jul-16 16:03 
GeneralRe: Because Reasons Pin
loctrice29-Jul-16 16:19
professionalloctrice29-Jul-16 16:19 
GeneralRe: Because Reasons Pin
Ravichanadeepakarandescarar29-Jul-16 16:39
Ravichanadeepakarandescarar29-Jul-16 16:39 
GeneralRe: Because Reasons Pin
loctrice29-Jul-16 17:50
professionalloctrice29-Jul-16 17:50 
GeneralRe: Because Reasons Pin
Vander Wunderbar31-Jul-16 11:37
Vander Wunderbar31-Jul-16 11:37 
GeneralRecursion schmecursion! Pin
PIEBALDconsult14-Jul-16 16:53
mvePIEBALDconsult14-Jul-16 16:53 
GeneralRe: Recursion schmecursion! Pin
Super Lloyd14-Jul-16 17:15
Super Lloyd14-Jul-16 17:15 
GeneralRe: Recursion schmecursion! Pin
Brisingr Aerowing14-Jul-16 17:28
professionalBrisingr Aerowing14-Jul-16 17:28 
GeneralRe: Recursion schmecursion! Pin
PIEBALDconsult14-Jul-16 18:50
mvePIEBALDconsult14-Jul-16 18:50 
GeneralRe: Recursion schmecursion! Pin
Brisingr Aerowing15-Jul-16 13:18
professionalBrisingr Aerowing15-Jul-16 13:18 

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.