Docsity

Object-Oriented Analysis and Design: CS6300/4320 Course Materials, Papers of Computer Science

Partial preview of the text

Download Object-Oriented Analysis and Design: CS6300/4320 Course Materials and more Papers Computer Science in PDF only on Docsity!

OO Analysis

UML Class Diagrams

Exercise

Use Case Diagrams

CS6300/4320 — Software

Development Process

Object-oriented Analysis

CS 6300/

• Precedence of data over function

• Encapsulation of data behind abstract

interfaces to hide representation design

decisions

• Reuse of object definitions by incremental

refinement (inheritance)

What is Object Orientation

CS 6300/

Why Use Objects?

• Reduce long-term maintenance costs by

limiting the effects of change

  • It is more likely for the functions provided by a software system to change than are its major data items
  • Encapsulation and information hiding

• Improved development process by reusing

existing code / designs

CS 6300/

Object-oriented Analysis/Design

  • Traditional design/analysis techniques are functionally oriented - Concentrated on the functions to be performed - The data upon which the functions operate are secondary to the functions themselves
  • Object-oriented analysis is primarily concerned with the data objects
  • Defined first in terms of their components and data types
  • Later functions (methods) are defined and associated with specific objects CS 6300/

Integrated Approach to Analysis & Design

• Rumbaugh and others have developed an

integrated approach to object-oriented

and functional modeling

• Three aspects:

  • Data
  • Functions
  • Control

CS 6300/

Integrated Approach to Analysis & Design

• Data: E/R diagrams augmented to describe

classes and inheritance

• Functions: DFDs (each function becomes a

method in a class)

• Control: State machines

• Various checks are provided to ensure the

consistency of the three models

• It evolved into UML, and then UMP and

USDP

CS 6300/

Object-oriented Analysis

• Requirements analysis technique that

concentrates on modeling real-world

objects

• Abbott and Booch, 1980s

• Refined by OMT and UML to include class

model diagrams

CS 6300/

Models

  • What is a model? a simplification of reality
  • Why do we model? to better understand the system that we are building
  • We build models of complex systems because we cannot comprehend such a system in its entirety => focus on one aspect at a time CS 6300/

Importance of Modeling

• Suppose you want to build a dog house

• Then you want a house for yourself

• Now what if you want a skyscraper

• Scale!

• BTW, many software projects that start

out as dog houses end up trying to be

skyscrapers (e.g., Jaba)

CS 6300/

Importance of Modeling

  • Help us communicate with the customer
  • Help us visualize a system as it is or as we want it to be
  • Let us specify the structure or behavior of a system
  • Give us a template that guides us in constructing a system
  • Help us document the decisions we have made CS 6300/

Principles of Modeling

  1. The choice of what models to create has a profound influence on how a problem is attacked and how a solution is shaped
  2. Every model can be expressed at different levels of precision
  3. The best models are connected to reality
  4. No single model is sufficient. Every non-trivial system is best approached through a small set of nearly independent models

CS 6300/

Class Diagrams

• Derived from OMT (Object Modeling

Technique, Rumbaugh)

• Static, structural view of the system

• Describes:

  • Classes and their structure
  • Dependency, association, and generalization relationships
  • Multiplicity and navigation indicators
  • Role names CS 6300/ Class Name -attribute -attribute: type = initial value +operation(arg-list): result-type ... ...

Class Diagrams

  • A class is drawn as a rectangle with 3 parts
  • Attributes and operations shown depend on desired level of detail
  • You can elide parts of a class (“…”)
  • A class can also have responsibilities (note)

CS 6300/ Copyright © 1997 by Rational Software Corporation

Class Diagrams Example

  1. The Registration Manager sets up the curriculum for a semester using a scheduling algorithm
  2. One course may have multiple course offerings
  3. Each course offering has a number, location and time
  4. Students select 4 primary courses and 2 alternative courses by submitting a registration form
  5. Students may use the system to add/drop courses for a period of time after registration
  6. Professors use the system to receive their course offering rosters
  7. Users of the registration system are assigned passwords which are used at logon validation CS 6300/ Copyright © 1997 by Rational Software Corporation RegistrationForm (^) RegistrationManager Course Student CourseOffering Professor ScheduleAlgorithm

Class Diagrams Example

CS 6300/ Copyright © 1997 by Rational Software Corporation RegistrationForm RegistrationManager addStudent(Course, Student) Course name numberCredits open() addStudent(Student) Student name major CourseOffering location open() addStudent(Student) Professor name tenureStatus ScheduleAlgorithm

Class Diagrams

CS 6300/ Copyright © 1997 by Rational Software Corporation

  • Relationships provide a pathway for communication between objects
  • Three main types:
    • Dependencies: X uses Y
      • Dashed, directed line
    • Associations: X has a Y
      • Solid, undirected line / line with diamond
    • Generalization: X is a Y
      • Solid directed line with large, open arrowhead

Relationships

CS 6300/ Copyright © 1997 by Rational Software Corporation

Relationships

• Dependency: relationship where a change

in the specification of one class (supplier)

may affect another class that uses it

(client), but not necessarily the reverse.

  • Most often used to show that one class uses another class as an argument in the signature of an operation
  • A dependency is shown as a dashed line pointing from the client to the supplier CS 6300/ Copyright © 1997 by Rational Software Corporation

Dependency Example

RegistrationManager addStudent(Course, Student) Student name major ScheduleAlgorithm RegistrationManager uses ScheduleAlgorithm in its implementation RegistrationManager gets a Student object as a parameter

CS 6300/

Name Example

CourseOffering location open() addStudent(StudentInfo) tenureStatus major Student Professor Registers for Gets roster from Associations can be labeled with names and arrows CS 6300/ Copyright © 1997 by Rational Software Corporation

Relationships

• Multiplicity: Defines number of objects

that participate in a relationship

  • Multiplicity is the number of instances of one class related to ONE instance of the other class
  • For associations and aggregations, there are two multiplicities: one for each end of the relationship

CS 6300/ Copyright © 1997 by Rational Software Corporation RegistrationForm RegistrationManager Course addStudent(Course, StudentInfo) name numberCredits open() addStudent(StudentInfo) ScheduleAlgorithm 1 0..* 1

Multiplicity Example

Edges are labeled with numbers; there can be many RegistrationForms, many Courses but only one RegistrationManager 0..* CS 6300/ Copyright © 1997 by Rational Software Corporation

Relationships

• Aggregation: A relationship between two

classes in which one represents a larger

class (whole), which consists of smaller

classes (parts)

  • Also known as as a “has-a” relationship
  • A plain association is adorned with an open diamond at the whole end

CS 6300/ Copyright © 1997 by Rational Software Corporation

Generalization Example

Student Professor name RegistrationUser Subclasses Student and Professor inherit from super- class RegistrationUser CS 6300/

Class Diagrams: Creation Tips

  • Understand the problem
  • Keep it simple (initially)
  • Choose good class names (vocabulary)
  • Look for 1-to- associations - Ignore multiplicities (initially) - Don’t feel like you have to use all constructs - Concentrate on WHAT - Refine until you feel it is complete and correct

Exercise

CS 6300/

Library Information System

  • This exercise asks you to create a UML class diagram that models the problem of managing the information resources for a library
  • Assume that somebody else will be designing the program from your analysis - Include classes, their attributes and operations and the relationships among them - Indicate attribute types, cardinality of associations, generalization and aggregation relationships