Advertisement

Inheritance Considered Harmful!

Part of the Springer Professional Computing book series (SPC)

23.8 Conclusions

In this chapter we have considered the benefits and drawbacks of inheritance within an objectoriented programming language.We have challenged the general perception that inheritance is by its very nature always good and have considered when it should and should not be used.We have reassessed compositional reuse and made the case that it is as important, in an object-oriented language,as inheritance in order to achieve the maximumpossible reuse.We can therefore provide a summary of our findings that can be used as a set of guiding principles for objectoriented development:
  • Avoid code dependency except on published protocol.

  • For structural inheritance direct extension is fine.

  • For functional inheritance compositional extension is to be encouraged.

  • Avoid inheritance if it is going to damage code cohesion.

Thus the final conclusion of this chapter is that inheritance can be harmful to a development project’s long-termchances of success if inheritance ismisused.However, in general it is essential for the power it provides to object-oriented systems.

Keywords

Parent Class Access Modifier Class Hierarchy Object Orientation Instance Variable 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

23.9 References

  1. Bitman, W.R. (1997). Balancing software composition and inheritance to improve reusability, cost and error rate. Johns Hopkins APL Technical Digest, 18(4), 485–500.Google Scholar
  2. Coleman, D., Arnold, P., Bodoff, S., Dollin, C., Gilchrist, H., Hayes, F. and Jeremes, P. (1994) Object-Oriented Development: The Fusion Method. Prentice Hall, Englewood Cliffs, NJ.Google Scholar
  3. Cox, B.J. (1986). Object-Oriented Programming: An Evolutionary Approach. Addison-Wesley, Reading, MA.Google Scholar
  4. Cox, B.J. (1990). There is a silver bullet. BYTE, October, pp. 209–218.Google Scholar
  5. DeSoto, A. (1997). Using the Beans Development Kit 1.0: A Tutorial, JavaSoft. http://splash.javasoft.com/beans/.
  6. Englander, R. Developing JavaBeans. O’Reilly and Associates.Google Scholar
  7. Firesmith, D.G. and Eykholt, E.M. (1995). Dictionary of Object Technology. SIGS Books.Google Scholar
  8. Goldberg, A. (1984). Smalltalk-80: The Interactive Programming Environment. Addison-Wesley, Reading, MA.Google Scholar
  9. Hunt, J.E. (1997). Smalltalk and Object Orientation: An Introduction. Springer-Verlag, London.Google Scholar
  10. Hunt, J.E. and McManus, A. (1998). Key Java: Tips and Techniques. Springer-Verlag, London.Google Scholar
  11. IBM (1994). The System Object Model (SOM) and the Component Object Model (COM): a Comparison of Technologies From a Developer’s Perspective. White Paper, IBM Corporation, Object Technology Products Group, Austin, TX.Google Scholar
  12. Kiczales, G. and Lamping, J. (1992). Issues in the design and specification of class libraries. Proc. OOPSLA92, ACM SIGPLAN Notices, 27(10), 435–451.Google Scholar
  13. Perry, D.E. and Kaiser, G.E. (1990). Adequate testing and object-oriented programming. Journal of Object-oriented Programming, 2(5), 13–19.Google Scholar
  14. Rumbaugh, J., Blaha, M., Permerlani, W., Eddi, F. and Lorensen, W. (1991). Object-Oriented Modeling and Design. Prentice Hall, Englewood Cliffs, NJ.Google Scholar
  15. Ryant, I. (1997). Why inheritance means extra trouble. Communications of the ACM, 40(10), 118–119.CrossRefGoogle Scholar
  16. Stasko, J.T., Domingue, J.B., Brown, M.H. and Price, B.A. (eds.) (1998). Software Visualization. MIT Press, Cambridge, MA.Google Scholar
  17. Stata, R. and Guttag, J. (1995). Modular reasoning in the presence of subclassing. Proc. OOPSLA95, ACM SIGPLAN Notices, 30(10), 200–214.Google Scholar
  18. Szyperski, C. (1998). Component Software: Beyond Object-Oriented Programming. Addison-Wesley, Reading, MA/ACM Press, New York.Google Scholar

Copyright information

© Springer-Verlag London Limited 2003

Personalised recommendations