Software Engineering: Reuse and Generics

Discussion in 'Scripts' started by beingchinmay, Sep 7, 2016.

  1. beingchinmay

    beingchinmay ECZ Member

    Jan 1, 2016
    Likes Received:
    Reuse is a key to holding down software costs. Writing and testing new code is always expensive. Templates are a critical means of providing efficient reusable code. Unlike the #define macro, templates are type-safe and properly scoped.

    As indicated in this chapter, templates are frequently no more expensive to develop than specialized code. Typically, the programmer writes the specialized case for a given type. This type should have characteristics representative of the different types the generic code would be instantiated with. The specialized code should be debugged and carefully tested until satisfactory. Then the programmer rewrites the specialized code in template form.