Click here to Skip to main content
15,791,891 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: auto-usings in Visual Studio Pin
MarkTJohnson11-Oct-23 5:55
professionalMarkTJohnson11-Oct-23 5:55 
GeneralRe: auto-usings in Visual Studio Pin
Gary Wheeler25-Oct-23 2:16
Gary Wheeler25-Oct-23 2:16 
GeneralRe: auto-usings in Visual Studio Pin
englebart25-Oct-23 14:07
professionalenglebart25-Oct-23 14:07 
GeneralDigital film cartridge adds 20 MP micro 4/3 sensor to any 35 mm film camera Pin
RickZeeland10-Oct-23 1:08
mveRickZeeland10-Oct-23 1:08 
GeneralRe: Digital film cartridge adds 20 MP micro 4/3 sensor to any 35 mm film camera Pin
trønderen10-Oct-23 5:43
trønderen10-Oct-23 5:43 
GeneralRe: Digital film cartridge adds 20 MP micro 4/3 sensor to any 35 mm film camera Pin
RickZeeland10-Oct-23 6:59
mveRickZeeland10-Oct-23 6:59 
GeneralThe changing landscape of OOP (from class to struct) PinPopular
raddevus25-Sep-23 7:04
mvaraddevus25-Sep-23 7:04 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Greg Utas25-Sep-23 8:04
mveGreg Utas25-Sep-23 8:04 
I agree that Primitive Obsession is a code smell. It can easily cause bugs when, for example, a plain integer is interpreted as a time duration. Was that in seconds? Milliseconds? Microseconds? There have been articles about the topic on this site. Here's one of them, but in C++:

Units and measures for C++ 11[^]

Fixing that code smell in a legacy system can be quite a bit of work.

I don't subscribe to the "prefer composition over inheritance" mantra when stated that simply. If B is a type of A, B should derive from A (inheritance). But if B only has an A, but also other behavior that has nothing to do with an A, B should contain an instance of A (composition). The problem with using composition when inheritance is called for is that B ends up cloning most of A's interface and forwarding to it.
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.

GeneralRe: The changing landscape of OOP (from class to struct) Pin
raddevus25-Sep-23 9:11
mvaraddevus25-Sep-23 9:11 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Greg Utas25-Sep-23 14:24
mveGreg Utas25-Sep-23 14:24 
GeneralRe: The changing landscape of OOP (from class to struct) PinPopular
Jeremy Falcon25-Sep-23 8:37
professionalJeremy Falcon25-Sep-23 8:37 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
raddevus25-Sep-23 9:06
mvaraddevus25-Sep-23 9:06 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Jeremy Falcon25-Sep-23 9:13
professionalJeremy Falcon25-Sep-23 9:13 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
raddevus25-Sep-23 9:35
mvaraddevus25-Sep-23 9:35 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Jeremy Falcon25-Sep-23 13:26
professionalJeremy Falcon25-Sep-23 13:26 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Nelek27-Sep-23 10:06
protectorNelek27-Sep-23 10:06 
QuestionRe: The changing landscape of OOP (from class to struct) Pin
Jeremy Falcon27-Sep-23 12:59
professionalJeremy Falcon27-Sep-23 12:59 
AnswerRe: The changing landscape of OOP (from class to struct) Pin
Nelek28-Sep-23 11:06
protectorNelek28-Sep-23 11:06 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Matt Bond27-Sep-23 5:37
Matt Bond27-Sep-23 5:37 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
trønderen25-Sep-23 10:59
trønderen25-Sep-23 10:59 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
trønderen25-Sep-23 9:41
trønderen25-Sep-23 9:41 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
raddevus25-Sep-23 11:15
mvaraddevus25-Sep-23 11:15 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Rick York25-Sep-23 11:25
mveRick York25-Sep-23 11:25 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
Nelek27-Sep-23 10:08
protectorNelek27-Sep-23 10:08 
PraiseRe: The changing landscape of OOP (from class to struct) Pin
Gary Wheeler27-Sep-23 2:36
Gary Wheeler27-Sep-23 2:36 

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.