CSci 581: Obj.-Oriented Design & Programming
Spring Semester 1999
Lecture Notes


Object-Oriented Design (Budd's UOOPJ, Ch. 3)

This is a set of "slides" to accompany chapter 3 of Timothy Budd's textbook Understanding Object-Oriented Programming with Java (Addison-Wesley, 1998).


Responsibility Driven Design (RDD)

Design technique that:


Directed Evolution

Take specifications as they occur in nature

Evolve the specification in concert with the design.


The Interactive Intelligent Kitchen Helper (IIKH)

Suppose you are the chief software architect in a major computing firm.

The president of the firm rushes into your office with a specification for the next PC-based product. It is drawn on the back of a dinner napkin.

Briefly, the Interactive Intelligent Kitchen Helper (IIKH) will replace the box of index cards of recipes in the average kitchen.

Your job is to develop the software that will implement the IIKH.


Capabilities of the IIKH

With the IIKH a user can:


Characterization by Behavior

In using Responsibility Driven Design (RDD) we first characterize the application by behavior:

  1. Capture behavior of entire application

  2. Refine into behavioral descriptions of subsystems

  3. Refine behavioral descriptions into code

This is the fundamental aspect of object-oriented programming.


Working Through Scenarios

The specification may be ambiguous.

Walk through application scenarios to uncover the desired behavior:


Software Components

Software component:
an abstract design entity with which we can associate responsibilities for different tasks

May eventually be a class, function, module, etc.

A component:


CRC Cards

Components are easily described using CRC cards.

CRC -- Component (class name), Responsibilities, Collaborators

Component Name
description of responsibilities
Collaborators
other components


The Greeter Component

First component defined is the Greeter

Writes a welcome message on the screen at startup

Offers the user a choice of actions:

Many details on how these are done can be ignored for now.


The Greeter CRC Card

Greeter
Display informative initial message
Offer user choice of options
Pass control to either
-- Recipe Database Manager
-- Plan Manager
Collaborators
Database Manager
Plan Manager


The Recipe Database Manager Component

Ignoring the planning of meals for now, your team next explores the recipe database component.


Postponing Decisions

Many decisions (e.g., method of browsing) can be ignored for now.

They are encapsulated within the recipe database component -- do not effect other components.

Only need to note that somehow user can manipulate database to select recipe


The Recipe Component

Make recipe itself an active data structure -- maintains information, also performs tasks:

We can extend to other actions later (ability to scale, produce grocery list, etc.)


The Plan Manager Component

Return to the Greeter, start different scenario

Identify the Plan Manager which:


The Date Component

The Date component holds sequence of meals for sequence of dates


The Meal Component

The Meal component holds information about a single meal


The Six Components

Having walked through the various scenarios, your team eventually decides everything can be accomplished using only six software components.

  1. Greeter

  2. Database Manager

  3. Plan Manager

  4. Recipe

  5. Date

  6. Meal





Figure 3.4 on page 40 of the Budd textbook pictures the communication patterns among the components.


Interaction Diagrams

An interaction diagram shows dynamic interactions during execution of a scenario:













Figure 3.5 on page 41 of the Budd textbook pictures shows the beginning of an interaction diagram for the IIKH.


Instances and Classes

There are likely many instances of recipe, but they will all behave in the same way.

We say the behavior is common to the class of recipes.

Recipe class
Recipe behavior
- Edit
- Display
Recipe instances
chicken &
dumplings
corn
bread
pecan
pie
iced
tea

Since earlier our goal was to identify behavior, we ignored this distinction and concentrated on prototypical objects.


Next Step -- Formalize the Interface

Formalize the channels of communication between the components


Coming Up with Names

The selection of names is an important task. Give it sufficient time and thought.


Documentation

In addition to CRC cards, develop other documentation from the project's beginning.

The two most important documents are:


User Manual

The user manual describes the application as seen by the user.


Quality

Always remember:
The primary measure of quality is the degree to which your customers (clients) are satisfied with your product.


System Design Documentation

Record the decisions made during system design.


Preparing for Change

Change is inevitable!
User requirements evolve, host platforms change, user organizations restructure, government regulations change, organizational missions shift, market expands (becomes global), etc.


Next Step -- Select Representations for Subsystems

Select the internal representation for each component:


Step -- Implement and Test Subsystems


Step -- Integration and Testing

Carefully and incrementally integrate components into completed system -- i.e., integration testing:


Maintenance and Evolution

Software does not remain fixed after the first working version is released.

A good design recognizes the inevitability of change -- plans for it from the beginning.


Common Design Flaws

Direct modification:
Classes that directly modify data in other classes violate encapsulation.

Such coupling results in inflexible designs.

Too much responsibility:
Classes with too much responsibility are difficult to understand and use.

Responsibility should be broken into smaller meaningful packages and distributed.

No responsibility:
Classes with no responsibility serve no purpose.

This often arises when designers equate physical existence with logical design existence.

Classes with unused responsibility:
Usually the result of designing software components without thinking about how they will be used.

Misleading names:
Names should be short and should unambiguously indicate which responsibility is involved.

Inappropriate inheritance:
This occurs when subclassing is used in situations where the concepts do not share an is-a relationship.


Acknowledgement

This Web document was based on a set of "slides" created by the instructor for use in the Fall 1997 offering of the object-oriented design and programming course. That set was, in turn, based on a set of slides created by Timothy Budd to supplement chapter 2 of his textbook An Introduction to Object-Oriented Programming, Second Edition (Addison-Wesley, 1997). The textbook for the current offering of the course is Budd's Understanding Object-Oriented Programming with Java (Addison-Wesley, 1998), which is an expanded, Java-specific variant of the earlier book.


UP to CSCI 581 Lecture Notes root document?


Copyright © 1999, H. Conrad Cunningham
Last modified: Wed Jan 19 10:31:01 CST 2000