Week 12 Class 21 Tue Mar 30 Posted: Mar 30

Class session:

  1. Announcements:
  1. Screencast: Design Pattern: Template Method notes

    The term template used here does not mean C++ templates. Later on, we will see how to implement the Template Method using C++ templates.

    To clearly show the design pattern, the code examples in the notes have the method definitions directly in the class definition. Real classes for real programs use multiple design patterns at the same time, along with the other processing they have to do. Put your method definitions in the .cpp file in the or on your project unless specifically instructed not to.

  2. Exercise 59: Design Pattern: Template Method Crossword

  3. Screencast: DockerReport: Template Method

    A. Replace YAMLParser with derived class DockerReportParser
    B. Add virtual extension points for Key and Value
    C. Copy callback processing to extension points
    D. Replace main() counts with DockerReportParser counts
    E. Remove callbacks and main() counts

    DockerReport IoC UML Class Diagram

    DockerReport Template Method UML Class Diagram

  4. Exercises 60-61: Template Method Dictionary

    Currently, the program Dictionary.cpp uses a class WordProcessor that implements extension points using Inversion of Control with lambda functions. As a reference, you can find that implementation at IoCDictionary.

    Your task is to create an equivalent program that uses the Design Pattern Template Method:

    Starting files for this (with much of it already completed) are in the repository for Dictionary. Your task is to finish the code to do what the IoCDictionary does, but using the Design Pattern Template Method. To finish, you will:

    See Brightspace for the GitHub Classroom repository link for Dictionary.

Screencast Folder: Class 21 Tue Mar 30

Exercise Due Date: 4 pm on Wednesday, Mar 31

Reminders: