Structural Modeling: Class Diagrams - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Structural Modeling: Class Diagrams

Description:

Shows. Classes. Interfaces. Collaboration. And their relationships. Classes ... Plane Car Truck. Disjoint and incomplete. ANIMAL. Herbivore Carnivore ... – PowerPoint PPT presentation

Number of Views:167
Avg rating:3.0/5.0
Slides: 23
Provided by: informat265
Category:

less

Transcript and Presenter's Notes

Title: Structural Modeling: Class Diagrams


1
Structural Modeling Class Diagrams
2
Class Diagrams
  • Provide static view of system
  • Most common type of diagram in OOAD
  • Forms basis for component and deployment diagrams
  • Shows
  • Classes
  • Interfaces
  • Collaboration
  • And their relationships

3
Classes
  • Definition of the word class
  • Oxford a number of individuals having a
    character or feature in common
  • Webster a number of persons or things regarded
    as forming a group by reason of common
    attributes, characteristics, qualities or traits

4
Classes in everyday life
  • Based on similar values for a particular, or
    group of attributes
  • All purple dinosaurs all green apples all
    Jesuits
  • Based on the range of an attribute
  • Everyone who is between 18-21 years of age
  • Based on similar behavior
  • Everyone who sleeps in class everyone in the
    ECIS program

5
All about Classes
  • Based on the notion of abstraction
  • Starts with identification of all common
    characteristics of a set of elements
  • All objects belong to a class
  • Objects represent an instance of a class
  • Software objects are built from a class through
    instantiation

6
Representation of a Class
CLASS NAME
Attributes
Operations ( )
7
Representation of a Class
MOTORCYCLE
Color Maximum Speed Engine
Start ( ) Brake ( )
8
Purpose of Class Diagrams
  • To model the vocabulary of the system
  • What lies within and without the system
  • To model simple collaborations
  • To visualize the relationship between classes
  • To model a logical database schema
  • Three major types of constructs in class diagrams
  • Inheritance structure
  • Association structure
  • Aggregation structure

9
Additional Concepts
  • Aggregation
  • A relationship between two classes where the
    instances of one class are, in some way,
    components, members , or contents of the
    instances of the other class (from Brown, 2002)
  • Types
  • Component (assembly)
  • Container (contents)
  • Collection (Member)

10
Aggregation Component
Car
Body
Transmission
Engine
Consists of
Car Part
11
Class Hierarchies
Vehicle
Land
Air
Bike
Car
Helicopter
Plane
(referred to as Generalization)
12
Problems with Classification
Animal
Two-legged
Four-legged
Carnivore
Herbivore
Carnivore
Herbivore
Why should I classify this way instead of
13
Class Hierarchies
Animal
Herbivore
Carnivore
4 legs
2 legs
4 legs
2 legs
This way?
14
Multiple Generalization
Animal
Herbivore
Carnivore
Two Legged
Four legged
Dog
15
Subclass Partitioning
  • Disjoint vs. Overlapping
  • Based on mutually exclusive subgroups
  • Incomplete vs. Complete
  • Coverage of the entire set

Powered Vehicle
ANIMAL
Disjoint and incomplete
Overlapping and complete
Plane Car Truck
Herbivore Carnivore
16
Relationships Between Classes
  • Associations
  • Objects are linked
  • Classes are associated
  • Represented as

(a link)
SU University
David Student
University
Student
(an association)
17
Multiplicity
  • Sometimes called the cardinalityof a
    relationship
  • The number of instances of each class that are or
    can be involved in a given association

1
University
Student

18
Other Examples

Driver
Bus


Customer
Product


Student
Course

1
Advisor
Student

19
Roles and multiplicity
1
University
Student

0..1
University
Teacher

May be replaced by..
teacher
employer

0..1
University
Person

1
student
20
An example
Aggregation (composed of..)
COMPANY
located
OFFICES
DEPARTMENT
Address Stringvoice number
Name Name
constraint
association


roles
subset
generalization
manager
member
1..
1
PERSON
HEADQUARTERS
Name NameempID IntegerTitle String
interface
Getphoto() Getsound() Getcontact() Getpersrec()
PersonnelRecord
taxId string Salary currency
21
Generalization vs. Aggregation
  • Can sometimes be confusing
  • Distinction can be made based on verb used
  • Generalization
  • The phrase IS A KIND OF
  • A car is a kind of vehicle
  • Aggregation
  • The phrase HAS A/AN
  • A car has an engine

22
An Example
BURNING LAMP
LAMP
ELECTRIC LAMP
BASE
WIRE
SWITCH
FLOURESCENT
INCANDESCENT
SOCKET
BULB
Write a Comment
User Comments (0)
About PowerShow.com