Click here to Skip to main content
16,014,952 members
Home / Discussions / C#
   

C#

 
GeneralRe: Should I be using inhertance for this? [modified] Pin
Jacob D Dixon4-Dec-10 17:14
Jacob D Dixon4-Dec-10 17:14 
GeneralRe: Should I be using inhertance for this? Pin
PIEBALDconsult5-Dec-10 3:49
mvePIEBALDconsult5-Dec-10 3:49 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon5-Dec-10 4:15
Jacob D Dixon5-Dec-10 4:15 
GeneralRe: Should I be using inhertance for this? Pin
PIEBALDconsult5-Dec-10 8:53
mvePIEBALDconsult5-Dec-10 8:53 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon6-Dec-10 16:17
Jacob D Dixon6-Dec-10 16:17 
GeneralRe: Should I be using inhertance for this? Pin
Spectre_0016-Dec-10 2:33
Spectre_0016-Dec-10 2:33 
AnswerRe: Should I be using inhertance for this? Pin
nortee5-Dec-10 21:29
nortee5-Dec-10 21:29 
AnswerRe: Should I be using inhertance for this? Pin
Steve Naidamast6-Dec-10 3:04
professionalSteve Naidamast6-Dec-10 3:04 
Inheritance should be used sparingly in business applications. In reality, in terms of these applications, inheritance has limited value compared to the internals, military, and scientific sectors.

Developers who use inheritance for the most part use it unnecessarily add a lot of ambiguity to the systems they are working on. Nonetheless, there are reasonable situations where inheritance can be of value; the most important being where you have numerous different types of constructs that basically belong within a same set of data (ie: security types; employee types).

That being said here are a few axioms that you should always follow when using inheritance as described by Tom Patton a number of years ago in his second edition of his COM+ Component programming manual:

1) Never use more than three levels of inheritance. Once this rule is broken inheritance hierarchies tend to become too complicated for easy maintenance.
2) Never use a "Protected" access modifier for a variable or method implementation. This attribute has been the bane of many inheritance hierarchies causing
them to fail. The reason being is that they tend to break such hierarchies when updated during maintenance.
3) Test your inheritance hierarchy thoroughly to make sure that it works in all scenarios as expected.
4) Test your inheritance hierarchy for its level of "black-box reuse". The more an inheritance hierarchy can be used without any understanding of anything
but the public API, the more concrete your structure will be. Most inheritance hierarchies tend to fall in the "white-box reuse" range meaning that there
are higher levels of maintenance required, which is not what you want.
5) If you find that your hierarchy is causing more issues than warranted either redesign it or drop the implementation all-together. It will only get worse as
it enters a production mode.
Steve Naidamast
Black Falcon Software, Inc.
blackfalconsoftware@ix.netcom.com

AnswerRe: Should I be using inhertance for this? Pin
mbb016-Dec-10 22:05
mbb016-Dec-10 22:05 
GeneralRe: Should I be using inhertance for this? Pin
nortee6-Dec-10 23:21
nortee6-Dec-10 23:21 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon8-Dec-10 3:46
Jacob D Dixon8-Dec-10 3:46 
AnswerRe: Should I be using inhertance for this? Pin
James Lonero8-Dec-10 8:41
James Lonero8-Dec-10 8:41 
QuestionMessage Removed Pin
4-Dec-10 13:27
SRJ924-Dec-10 13:27 
AnswerRe: Game Creation Pin
Luc Pattyn4-Dec-10 13:56
sitebuilderLuc Pattyn4-Dec-10 13:56 
GeneralRe: Game Creation Pin
SRJ924-Dec-10 14:09
SRJ924-Dec-10 14:09 
GeneralRe: Game Creation Pin
Luc Pattyn4-Dec-10 14:16
sitebuilderLuc Pattyn4-Dec-10 14:16 
GeneralRe: Game Creation Pin
SRJ924-Dec-10 14:21
SRJ924-Dec-10 14:21 
GeneralRe: Game Creation Pin
Pete O'Hanlon5-Dec-10 9:33
mvePete O'Hanlon5-Dec-10 9:33 
GeneralRe: Game Creation Pin
Luc Pattyn5-Dec-10 13:56
sitebuilderLuc Pattyn5-Dec-10 13:56 
QuestionwindowsForms Pin
nasis14-Dec-10 2:16
nasis14-Dec-10 2:16 
AnswerRe: windowsForms Pin
Eddy Vluggen4-Dec-10 2:37
professionalEddy Vluggen4-Dec-10 2:37 
AnswerRe: windowsForms Pin
Keith Barrow4-Dec-10 5:16
professionalKeith Barrow4-Dec-10 5:16 
GeneralRe: windowsForms Pin
Not Active4-Dec-10 5:50
mentorNot Active4-Dec-10 5:50 
GeneralRe: windowsForms Pin
fjdiewornncalwe4-Dec-10 7:53
professionalfjdiewornncalwe4-Dec-10 7:53 
GeneralRe: windowsForms Pin
Pete O'Hanlon4-Dec-10 11:47
mvePete O'Hanlon4-Dec-10 11:47 

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.