CSE687 - Object Oriented Design

Lecture #10 - Substitution Principle

Revised: 27 February 2008
Home Courses Code Handouts CoreTech Books Articles Math Research Masters Projects SWDev WebDev News OtherLinks SiteDesign Graduates AllPages Office Hours Notices Contents

CSE681-SWMAA CSE686-IP CSE687-OOD CSE775-DO CSE776-DP CSE778-AWP CSE784-SWS

Lecture #01 Lecture #02 Lecture #03 Lecture #04 Lecture #05 Lecture #06 Lecture #07
Lecture #08 Lecture #09 Lecture #10 Lecture #11 Lecture #12 Lecture #13 Lecture #14
Lecture #15 Lecture #16 Lecture #17 Lecture #18 Lecture #19 Lecture #20 Lecture #21
Lecture #22 Lecture #23 Lecture #24 Lecture #25 Lecture #26 Lecture #27 Lecture #28

Contents Syllabus SG - Design SG - Templates SG - Class Relationships

Web Resources:

Stroustrup's Home Page, Assoc. of C/C++ Users, C++ at Microsoft, Code Project, Sells Brothers, Guru of the Week, C/C++ User's Journal, devCentral, Dr. Dobb's Journal, Boost Library, techNetCast

Office Hours: Instructor & TAs

Content:

This lecture covers the Liskov Substitution Principle and its powerful applications in design. Polymorphism follows directly from Liskov Substitutability and helps us build loosely coupled systems.
  1. Syllabus
    Describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. Project #2
  3. Project #2 Help, Experiments with Graph implementations
  4. XML Presentation
  5. XMLParsing or XMLTran
    Two modules that do basic XML handling - building XML strings and pulling them apart. They do not understand XML namespaces or schemas, nor do they build a DOM. Either one will provide some parsing parts for Project #2.
  6. Using Inheritance
    Discusses several distinct design uses for inheritance.
  7. The Command Pattern is an interesting application of inheritance:
    Simple Callbacks - Function Pointers
    Callbacks - Command Pattern
    Callbacks - Commands to either global and member functions
  8. Virtual Function Pointer Table structure
  9. hiding
    Illustrates errors caused by inappropriate overloading and use of default parameters.
  10. importance of virtual destructors
    Demonstrates problems caused by omission of virtual destructors.
  11. Traceable Project
    This demonstrates the Open/Closed Principle by building a trace class that is very string-like, using the std::string class via inheritance without modifing std::string in any way. We get an enhanced string that knows a little about tracing program operation.
  12. Liskov Substitution Principle
    This is a fundamental OOD principle, with some surprising subtleties when using C++ (see example project below).
  13. Non-Virtual Interface Principle - a code example: see comments for explaination
    Liskov Substitutibility does not demand public virtual functions.
  14. C++ Casts
  15. Design Rules
    Design rules and idioms that transcend Object Oriented Design.
  16. Lecture #10 folder
    Contains a page of links to presentations and code discussed in this class. The Lecture folders will occasionally hold physical files of interest as well. Usually, however, all the materials of interest to the class are in the presentations and code folders. The contents of these folders will grow as you progress through the course.