C++ templates considered harmful

H. Paul Haiduk · Journal of computing sciences in colleges · 2004

C++ is considered by many professional software developers and educators to be the lingua franca of programming languages. Once mastered, its power of expression is nearly limitless for the class of problems for which an imperative and object-oriented programming language is suited. Template classes are one feature of the language that are widely embraced and taught. In fact it seems that the majority of C++ CS II texts rely heavily on the use of templates with discussion of inheritance and polymorphism given token treatment. This emphasis is harmful to and constrains the student's understanding of data abstraction, inheritance and polymorphism by focusing on the encapsulation facet of object-oriented programming and ignoring inheritance and polymorphism. This paper presents an alternative approach that permits a C++-based CS II experience to also prepare students to deal with collection classes as realized in Java and C#, for example.

Read the paper · More papers on PaperTik