Click here to Skip to main content
15,887,135 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: Trick for young players. Pin
J4amieC31-Oct-12 22:24
J4amieC31-Oct-12 22:24 
GeneralRe: Trick for young players. Pin
Jörgen Andersson1-Nov-12 0:12
professionalJörgen Andersson1-Nov-12 0:12 
GeneralRe: Trick for young players. Pin
_Maxxx_1-Nov-12 1:35
professional_Maxxx_1-Nov-12 1:35 
GeneralRe: Trick for young players. Pin
J4amieC1-Nov-12 2:05
J4amieC1-Nov-12 2:05 
GeneralRe: Trick for young players. Pin
_Maxxx_1-Nov-12 2:12
professional_Maxxx_1-Nov-12 2:12 
GeneralRe: Trick for young players. Pin
BobJanova1-Nov-12 3:27
BobJanova1-Nov-12 3:27 
GeneralRe: Trick for young players. Pin
OriginalGriff1-Nov-12 9:28
mveOriginalGriff1-Nov-12 9:28 
GeneralRe: Trick for young players. Pin
_Maxxx_1-Nov-12 11:41
professional_Maxxx_1-Nov-12 11:41 
If I may be clear, I understand what is happening and why - the fact remains it is an inconsistency.
If each object had two booleans, would it act the same?
As an'outside observer' the behavior is inconsistent.

In the case where this came up, the framework was processing parameters passed to a constructor, and trying to find the best constructor to use based on the parameters.

The routine in question failed if two booleans were passed because e second was deemed to be the same parameter as the first when their values were equal.

Because this is a framework, and until now nobody had happened to write a constructor with multiple value types of the same type, and subsequently try to use it with those value types having the same value, nobody had noticed the issue.

If lit had been integers rather than booleans it would have been even more interesting - as the chances of the values also being equal wold be that much smaller.

So, I under stand what is happening, but I still regard this as an issue with the potential for causing larger problems I an application.

The fact that the Contains method works inconsistently depending on the contents of objects is the problem.

I ask 'does object a contain object b'

And I expect the answer to be yes or no - and not 'well, if it's an object containing only a value type, then the collection contains at least one similar Object where the value type has the same value, but if it's a reference type then that instance exists I the collection'

This means in principal that I need to know about the objects in any collection beforehand - which especially in a framework environment, I do not.
MVVM# - See how I did MVVM my way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011

.\\axxx
(That's an 'M')

GeneralSo to really make you weep Pin
Jörgen Andersson1-Nov-12 21:28
professionalJörgen Andersson1-Nov-12 21:28 
GeneralRe: So to really make you weep Pin
_Maxxx_4-Nov-12 11:54
professional_Maxxx_4-Nov-12 11:54 
GeneralRe: So to really make you weep Pin
Jörgen Andersson4-Nov-12 22:54
professionalJörgen Andersson4-Nov-12 22:54 
GeneralRe: So to really make you weep Pin
Stefan_Lang5-Nov-12 1:33
Stefan_Lang5-Nov-12 1:33 
GeneralRe: So to really make you weep Pin
Jörgen Andersson5-Nov-12 1:38
professionalJörgen Andersson5-Nov-12 1:38 
GeneralRe: So to really make you weep Pin
Stefan_Lang5-Nov-12 2:03
Stefan_Lang5-Nov-12 2:03 
GeneralRe: So to really make you weep Pin
Jörgen Andersson5-Nov-12 2:10
professionalJörgen Andersson5-Nov-12 2:10 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 0:47
BobJanova2-Nov-12 0:47 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 1:15
professional_Maxxx_2-Nov-12 1:15 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 1:46
BobJanova2-Nov-12 1:46 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 2:01
professional_Maxxx_2-Nov-12 2:01 
GeneralRe: Trick for young players. Pin
Harley L. Pebley2-Nov-12 6:18
Harley L. Pebley2-Nov-12 6:18 
GeneralRe: Trick for young players. Pin
_Maxxx_4-Nov-12 11:56
professional_Maxxx_4-Nov-12 11:56 
GeneralRe: Trick for young players. Pin
Sentenryu1-Nov-12 5:47
Sentenryu1-Nov-12 5:47 
GeneralRe: Trick for young players. Pin
twizzle8011-Nov-12 19:32
twizzle8011-Nov-12 19:32 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 0:07
professional_Maxxx_2-Nov-12 0:07 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 0:50
BobJanova2-Nov-12 0:50 

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.