Title: cs2340: UML and Class Diagrams
1cs2340 UML and Class Diagrams
2Tutoring For CS 2340
- Not understanding the concepts?
- Not making the grades expected or wanted?
- CoC has free tutoring available.
- Utilize this opportunity to improve your
knowledge and your grades. - Contact Margaret Clayton mclayton_at_cc.gatech.edu
- Set up an appointment now!
3Unified Modeling Language
- Three Amigos Booch, Rumbaugh (OMT), Jacobson
(OOSE) - OMG Standard
- CASE Tool Support (Rational Rose)
- For this class Version 2.0
- OCL Formal Specifications
4Model and View Diagrams
Implementation View
Class Diagram Object Diagram
Composite Structure Diagrams
User View Use Case Diagrams
Structural View
Component Diagrams
Communication Diagram Collaboration Diagram State
Diagram Activity Diagram Timing Diagram
Deployment Diagram
Behavioral View
Environment View
5Why so many diagrams?
Different stakeholders
Different concerns
Why not just one blueprint for a skyscraper?
6Package Diagrams
- Show basic package structure
- represents packages or namespaces
- Each classname in a package must be unique
- Show dependencies between packages
- Something in a package uses something in another
package - Typically a class in one package calls methods in
another class.
7Packages
A dependency
ServerServer
A Fully-Qualified Name
A package
8Simple Package Diagram
Well-structured is acyclic
9Class Diagrams
- A class diagram shows
- Packages (sub-packages of our package diagram)
- Classes
- Attributes
- Methods
- Interfaces
- Collaborations
- Dependency, Generalization, Relationships
- A class diagram is a STATIC view of system
10Three Levels of Class Diagrams
- Conceptual (Domain) Model
- Analysis (Specification)
- Implementation
11Basic Class Diagrams
12Basic Class Diagrams
public protected - private package /
derived
Abstract abstract
constructor query update
Class Scope (static)
Formats for boxes Visibility Attribute_Name
MultiplicityType Initial_Value
property-string Visibility Method_Name
(Parameter_List) Return-List
property-string kind param_Name type
default value , where kind in,
out , inout and surround optional items
13Basic Class Diagrams
Superclass
Class with parts
Note
Assembly Class
Subclass
Composition (Aggregation) (part-of, has-a)
Association (relationship)
Inheritance (Generalization) (is-a, kind-of)
14Basic Class Diagram (Example)
15Basic Class Diagram (Example)
16Class Diagrams (Advanced)
Cardinality (Multiplicity) 1 0..1 0.. 1..
64 2..5 2,4,10
takes
0..
17Class 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
18Class Diagrams (Advanced)
Aggregation (independent object lifetime)
Composite (unique member, dependent)
Exception handling
Can have self-associations
ltltsendsgtgt
manager
manages
employee
implements
directionality
19Class Diagrams (Advanced)
20One Additional Class Box
Class with independent Runtime thread of
execution AKA Active Class
21From Domain to Analysis (Specification)
22From Analysis (Specification) to Implementation
Book
Author
-isbnstring -titlestring writtenby5 Author
-namestring
- writtenby OrderedCollection
23From Implementation to Code
Author
Smalltalk.Library defineClass Author
superclass Core.Object indexedType
none private false instanceVariableNames
'name writtenBy ' classInstanceVariableNames
'' imports '' category
'Library name aString name
String initialize writtenBy
OrderedCollection new
-namestring
- writtenby OrderedCollection
Book
-isbnstring -titlestring writtenby5 Author