1,903 reputation
410
bio website
location
age
visits member for 3 years, 6 months
seen Jan 8 at 15:38

Oct
14
awarded  Yearling
Mar
4
comment Duplication in parallel inheritance hierarchies
I have since learned that this problem has a name in the programing languages literature "the expression problem".
Oct
14
awarded  Yearling
Feb
16
answered Modern Java implementation of Blackboard Pattern?
Feb
3
awarded  Nice Answer
Jan
13
comment How is Python used in the real world?
+1 we also use python for automated testing
Dec
22
comment Would you rather make private stuff internal/public for tests, or use some kind of hack like PrivateObject?
@AlanDelimon Might it not hurt the mind of subsequent maintenance programmers?
Dec
22
answered Would you rather make private stuff internal/public for tests, or use some kind of hack like PrivateObject?
Dec
21
comment What's the worst question you were ever asked at interview?
@DVK - "standard feminist beliefs"? I swear I nearly wet myself! (You did mean that comment to be a joke right?)
Dec
21
comment Why was I asked general, non-technical questions during an interview?
Ermmm, sorry to be a bust, but I was wondering if someone could cite some quantitative scientific research that supports the assertions being made about "people of Asian cultures" and "westerners" in this post? Where did these claims about the behaviour of maybe several billions of people come from? I would also like to know why the assumption is made that the amazon interviewer is first language english and not infact Asian himself? Or am I missing the point?
Oct
14
awarded  Yearling
Jul
23
answered Should a developer have fast-typing skill?
Jul
20
answered How to hire a good C# developer if I don't know C#?
Jul
20
comment Duplication in parallel inheritance hierarchies
I have used this solution in a few cases, and it does work in the somewhat simple example I have given here. But the number and complexity of generic parameters grows very quickly if a few more classes are involved. It seems to me to end up with the "Container" class having a generic parameter for every type that can vary in the graph. For example an actual model I have built has about 7 classes that vary by protocol. The topology of the object graph is the same, but the attributes of each object vary by protocol and "foo" objects cannot mix with the "bar" objects.
May
10
comment Duplication in parallel inheritance hierarchies
I think that this solution requires a language with dynamic dispatch? Although something similar is possible in Java, etc, using a visitor or double dispatch pattern. But I am thinking of the question more from the point of view of using OO to modell the domain. I want to capture the rule that "Destinations are associated with Sources" as well as the rule that "FooDestinations are associated with FooSources" and "BarDestinations are associated with BarSources" with as little duplication as possible.
Apr
5
comment Duplication in parallel inheritance hierarchies
So, a more concrete example is a network. A network consists of, say, clients and servers each with an "address". However, a network also has a protocol associated with it. All addresses within a Foo network have to be FooAdresses, and all addresses within a Bar network have to have BarAddresses. I never want a FooClient in a BarNetwork. However, some operations (e.g.) drawing a diagram of the network in a GUI do not really care about that rule as they maybe don't even render the values of the addresses. So you have an abstract use but still need to enforce the business rule for the protocol.
Apr
5
comment Code Smell: Inheritance Abuse
thanks I understand now
Mar
16
comment Duplication in parallel inheritance hierarchies
I agree, they should probably be in different packages, but I left the packaging/file arrangement out for simplicity. I don't think it really affects the underlying design issue, which is that the underlying structure of the object model is repeated for each new flavour (here foo and bar, but in reality often many more times).
Mar
15
comment Is Agile the new micromanagement?
+1 estimating relative complexity
Mar
15
comment Code Smell: Inheritance Abuse
Could you maybe expand a little on what you mean by "composition will require some violation of DRY" please?