Tagged Questions
7
votes
6answers
880 views
Why is subclassing too much bad (and hence why should we use prototypes to do away with it)?
I was reading up on design patterns, and I read that the prototype design pattern does away with excessive subclassing.
Why is subclassing bad? What advantage would using a prototype bring about over ...
7
votes
9answers
923 views
What OO Design to use ( is there a Design Pattern )?
I have two objects that represent a 'Bar/Club' ( a place where you drink/socialise).
In one scenario I need the bar name, address, distance, slogon
In another scenario I need the bar name, address, ...
6
votes
6answers
2k views
When you use inheritance to reuse code, do you find it too tricky that it swallows the benifits of reuse?
I've been coding for about 8 years, however I still find inheritance is too flexible and sometimes it makes you totally confused with the code you have written. One simplest example would be:
...
2
votes
2answers
387 views
Alternative to “inheritance versus composition?” [duplicate]
Possible Duplicate:
Where does this concept of “favor composition over inheritance” come from?
I have colleagues at work who claim that "Inheritance is an anti-pattern" and want to use ...
2
votes
2answers
93 views
Template method within one class without subclasses or inheritance
I have an algorithm with mostly invariant parts that needs to be reused within one class so as to stay DRY.
Code duplication with repeating method structure
public void save(String key, int value) ...
0
votes
2answers
188 views
Inheritance versus Composition in a business application
I have a training management and tracking system, with a high level structure as follows:
We have a Role1, e.g. Manager, Shift-boss, miner, etc. and a Candidate, training for that Role. The role has ...