Advertisement

Encapsulating Object Creation

  • Edward Sciore
Chapter

Abstract

Polymorphism enables code to be more abstract. When your code references an interface instead of a class, it loses its coupling to that class and becomes more flexible in the face of future modifications. Such abstraction is not possible with class constructors. This chapter examines the techniques of object caching and factories, which help the designer to restrict constructor usage to a small, well-known set of classes.

Copyright information

© Edward Sciore 2019

Authors and Affiliations

  • Edward Sciore
    • 1
  1. 1.NewtonUSA

Personalised recommendations