UML Class Diagrams - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

UML Class Diagrams

Description:

A class diagram is a STATIC view of system. Three Levels of Class Diagrams ... Basic Class Diagram (Example) Person name : String - ssn : String # birthday : Date ... – PowerPoint PPT presentation

Number of Views:337
Avg rating:3.0/5.0
Slides: 22
Provided by: Robert9
Category:
Tags: uml | class | diagrams

less

Transcript and Presenter's Notes

Title: UML Class Diagrams


1
UML Class Diagrams
  • CS2335
  • Fall 2003

2
Miscellaneous
  • Drawing Software
  • Dia
  • Visio, Argo, Poseidon
  • Rational Rose
  • From csh in Baird cluster type
  • source /usr/local/rational/rs_setup.csh
  • rose
  • Hand-drawn and then scanned

3
Agenda
  • Class Diagrams
  • Symbology
  • Basic Modeling
  • Intermediate Modeling

4
Class Diagrams
  • A class diagram shows
  • Classes
  • Attributes
  • Methods
  • Interfaces
  • Collaborations
  • Dependency, Generalization, Relationships
  • A class diagram is a STATIC view of system

5
Three Levels of Class Diagrams
  • Conceptual (Domain) Model
  • Analysis (Specification)
  • Implementation

6
Basic Class Diagrams
7
Basic Class Diagrams
public protected - private package /
derived
Abstract abstract
constructor query update
Class Scope
Formats for boxes Visibility Attribute_Name
MultiplicityType Initial_Value Visibility
Method_Name (Parameter_List) Return-List Kind
param_Name type default value
where kind in, out , inout
8
Basic Class Diagrams
Superclass
Class with parts
Note
Assembly Class
Subclass
Composition (Aggregation) (part-of, has-a)
Association (relationship)
Inheritance (Generalization) (is-a, kind-of)
9
Basic Class Diagram (Example)
takes
10
Basic Class Diagram (Example)
Person
name String - ssn String birthday
Date / age int
getName String query -calculateAge int
11
Class Diagrams (Advanced)
Cardinality (Multiplicity) 1 0..1 0.. 1..
64 2..5 2,4,10
takes
0..
12
Class Diagrams (Advanced)
Important Stereotypes ltltinterfacegtgt specify
collection of operations to specify
services ltlttypegtgt specify structure and
behavior (not implementation) ltltenumerationgtgt
specify discrete values ltltimplementationClassgtgt
helper class created in detail design
ltltenumerationgtgt Status
Idle Working Error
Fundamental Attributes
readImage writeImage
Fundamental behavior
13
Class Diagrams (Advanced)
Aggregation (independent object lifetime)
Composite (unique member, dependent)
Can have self-associations
Exception handling
ltltsendsgtgt
manager
manages
employee
directionality
14
Class Diagrams (Advanced)
15
From Domain to Analysis (Specification)
16
From Analysis (Specification) to Implementation
Book
Author
isbnstring titlestring
written by
namestring

1..5
Book
Author
isbnstring titlestring writtenby5 Author
namestring
writtenby ListltBookgt
17
From Implementation to Code
Author
public class Author protected
stdstring name stdlistltBookgt
writtenby public class Book protected
stdstring isbn stdstring title
Author writtenby5
namestring
writtenby ListltBookgt
Book
isbnstring titlestring writtenby5 Author
18
Class Diagram Hints
  • Provide abstraction of problem domain
  • Embodies small set of well-defined
    responsibilities
  • Clear separation between specification and
    implementation
  • Understandable and simple
  • Show only important properties

19
Class Diagram Hints
  • Organize similar classes into packages
  • Beware of cyclical generalization
  • Use associations where there are structural
    relationships
  • Associations are NOT comm pipes!!!!!!!
  • Start with Conceptual model, then refine details
    thru specification and implementation

20
Design Digression
  • Inheritance vs. Composition
  • Information Hiding
  • Delegation Design Pattern
  • Inheritance vs. Attribute
  • Attribute vs. Class
  • Association Checklist (page 156)
  • Class Identification (page 134)
  • Domain analysis
  • Nouns in requirements
  • Data-driven vs. Responsibility-driven
  • Proxy Classes

21
Space Invader Class Diagram
Write a Comment
User Comments (0)
About PowerShow.com