CSE687 - Lecture #2 Design Note

Prime Directives (PD)

Revised: 12/9/2009
Home Courses Code Books Handouts Research SWDev WebDev News OtherLinks SiteDesign

CSE681-SWMA CSE687-OOD CSE691-IP CSE775-DO CSE776-DP CSE778-AWP CSE784-SWS

Design Study Guide


Prime Directives (PD):

  1. No surprises
    A component, e.g., a module or class should act the way it looks like it should act. The interface should describe what it does in a way that any competent developer can understand.
    C++ provides operator notation so a class can support syntax that fits the class's model, e.g., matrix, string, ...
  2. Maximize Cohesion
    Things that are grouped together should be related in function and be focused on a single objective.
    C++ classes have a fairly low syntactic overhead, so it is practical to create small cohesive classes.
  3. Minimize Coupling
    When a component changes, everything it?s coupled to may need to change. Try to couple only to interface, not implementation. Try to minimize ?assumption? coupling and ?need to know? coupling as well as data coupling.
    References:
    C++ supports passing and returning references from functions. This greatly reduces the need to pass pointers into and out of functions, making them much less susceptible to client miss-use.

    Polymorphism:
    C++ supports dynamic binding with virtual functions, providing strong support for building loosely coupled systems. The client of a base class need know only the protocol provided by the base and need not know the details that distinguish one derived class from another.

Examples:

  1. The tok module, in semi project folder is responsible for extracting tokens from a stream.
  2. tok contains three classes: