The inheritance tag has no wiki summary.
3
votes
2answers
136 views
Does Parallel Inheritance Make for Good Code?
I'm writing a database interface in PHP and I have a base dbTables class, as well as a base dbTableFields class.
dbTables has a function, getFields(), that instantiates dbTableFields objects, each of ...
1
vote
2answers
71 views
Extend the API or use the same name as a class in the API?
I have been running into this problem more and more: I am not happy with the current API, and end up making my own class that does what I wish the API did; however, I don't extend the 'super class' as ...
4
votes
1answer
133 views
Any valid reason to Nest Master Pages in ASP.Net rather than Inherit?
Currently in a debate at work and I cannot fathom why someone would intentionally avoid Inheritance with Master Pages.
For reference here is the project setup:
BaseProject
...
3
votes
2answers
126 views
Derived Classes and namespaces
I am deriving a class, for use in my application, from a class provided by another group. Should the derived class be in the namespace for my application or the namespace of the parent class?
While ...
6
votes
6answers
571 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 ...
2
votes
1answer
179 views
Rails - to use STI or not…that is the question
Six months ago, I asked a question about modeling data for my app, and received some advice pointing me towards STI (see Rails data model - best practices question for the details).
I played around ...
6
votes
5answers
287 views
Interface and Inheritance: Best of both worlds?
I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required.
...
13
votes
4answers
1k views
Why should I prefer composition over inheritance?
I always read that composition is to be preferred over inheritance. A blog post on unlike minds, for example, advocates using composition over inheritance, but I can't see how polymorphism is ...
5
votes
3answers
325 views
When calling a method should we use base.methodname and this.methodname?
In C#, with an inherited class set -- when calling a method should we use keywords 'base.methodname and this.methodname'... irrespective of whether it is a overridden method or not?
The code is ...
1
vote
2answers
262 views
Are super methods in JavaScript limited to functional inheritance, as per Crockford's book?
In Douglas Crockford's "JavaScript: The Good Parts", he walks through three types of inheritance: classical, prototypal, and functional. In the part on functional inheritance he writes:
"The ...
4
votes
2answers
210 views
Who decided on the terminology downcasting and upcasting?
As far as I know, the terminology comes from how the inheritance hierarchy is traditionally displayed, with the extending types at the bottom, and the parent types at the top.
This is a bit ...
11
votes
3answers
1k views
Best design for Windows forms that will share common functionality
In the past, I have use inheritance to allow extension of Windows forms in my application. If all of my forms would have common controls, artwork, and functionality, I would create a base form ...
9
votes
3answers
379 views
Inheritance vs mixins in dynamic languages?
When should you prefer inheritance patterns over mixins in dynamic languages?
By mixins, I mean actual proper mixing in, as in inserting functions and data members into an object in runtime.
When ...
-1
votes
2answers
103 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 ...
1
vote
2answers
100 views
Does hierarchial inheritance belong to the past? [closed]
Recently it came to my attention that hierarchical inheritance may be a relic of thinking of classes as "structs with functions" rather than a product contract-driven mentality.
Consider, as a simple ...