Efficiency and Polymorphism

We have, in this chapter, examined a number of different forms of polymorphism. It would be dishonest to leave this chapter without at least mentioning the word efficiency.

In a word, polymorphism usually means a loss of efficiency.

However, programming is always a compromise. Polymorphism can give you great gains in programming time, in reliability, in correctness, and so on. These are often, but pointedly not always, much more important than raw execution time. This can be summarized by the retorical questin, whos time is more important, yours or the computers?

[audio] [real] Text to accompany slide22, in Chapter 14 of An Introduction to Object-Oriented Programming