UML - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

UML

Description:

Define a public class that provides the public behavior of the package ... Use them when the system class diagram is not legible on a single letter size sheet of paper ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 23
Provided by: frank422
Category:
Tags: uml

less

Transcript and Presenter's Notes

Title: UML


1
UML Programming
  • Activity diagrams
  • Package diagrams
  • Deployment diagrams
  • Moving to code

2
Activity diagrams
condition 1
  • Dynamic aspects of a
  • system
  • Describe
  • parallel processing
  • workflows
  • Show flow from activity to
  • activity
  • Activity
  • conceptual task to be done
  • specification/implementation
  • method

condition 2
synchronization condition
3
Example activity diagram
4
UML Programming
  • Package diagrams
  • Deployment diagrams
  • Moving to code

5
How to break a system into smaller systems?
  • Roman principle Divide conquer
  • Split up a large system into manageable parts
  • Structured methods functional decomposition
  • OO Group classes into higher level
    units Packages

6
Package diagrams
  • Show packages
  • Show dependencies between packages
  • Dependency exists between 2 elements if changes
    to the definition of one element may cause
    changes to the other
  • Goal ( art) of large scale designMinimize
    dependencies
  • Constraints effects of changes

7
Example package diagram
Order Capture
AWT
Mailing List
UI
UI
Order Capture
Mailing List
Application
Application
Orders
Customers
8
Package diagram for the assignment
Project
Project Member
Planning GUIs
GUIs
Project Plan
Management
Resource Pool
Workflow Engine
Product Version
Management
9
Dependencies between packages
  • Exist whenever there exist a dependency between
    classes of both packages
  • class A calls method of class B
  • class A has instance of B as part
  • method of A has parameter of type B
  • Dependencies are not transitive (compilation
    dependencies are)

Shields UI from Project Plan Management (Layered
architecture)
Project
Project Member
Planning GUIs
GUIs
Project Plan
Management
Resource Pool
Workflow Engine
Product Version
Management
10
Nested packages
  • 2 interpretations
  • transparent all contents of contained packages
    visible
  • opaque only classes of the container are visible

Order Capture
AWT
Mailing List
UI
UI
Order Capture
Mailing List
Application
Application
Domain
Orders
Customers
11
How can the complexity of a package interface be
restricted?
  • Give all classes in the package only package
    visibility
  • Define a public class that provides the public
    behavior of the package
  • Delegate the public operations to the appropriate
    class inside the package Facades Gamma et al.
    1994

12
Rules of thumb
  • Try to avoid cycles in the dependency structure
  • Too many dependencies Try to refactor the system
  • Use them when the system class diagram is not
    legible on a single letter size sheet of paper

13
UML Programming
  • Package diagrams
  • Deployment diagrams
  • Moving to code

14
Deployment diagrams (1)
  • Show physical relationship among software
    hardware components
  • Show where components of a distributed system are
    located

15
Deployment diagrams (2)
  • Nodes Computational units (most often Hardware)
  • Connections Communication paths over which the
    system will interact

16
UML Programming
  • Package diagrams
  • Deployment diagrams
  • Moving to code

17
Example - classes packages
Object
(from java.lang)
Traveling
Location
city
Car
currentLocation Location
getCity( )
builtDate Date
setCity( )
start( )
stop( )
goto( )
18
Class definition
  • package Traveling
  • public class Car
  • private Location currentLocation
  • private java.sql.Date builtDate
  • public class Location
  • private java.lang.String city

19
Adding methods
  • public class Car
  • private Location currentLocation
  • private java.util.Calendar builtDate
  • public void start ( )
  • return
  • public void stop ( )
  • return
  • public void gotoLocation (Location newLoc )
  • currentLocation newLoc

20
Example - state diagram
start gas available
started
stopped
Additional attributes needed! state
String gasAvailable Boolean
stop
21
State transitions
  • public class Car
  • private Location currentLocation
  • private java.util.Calendar builtDate private
    String state
  • private boolean gasAvailable
  • public void start ( )
  • if (gasAvailable) state "started"
  • return
  • public void stop ( )
  • state "stopped"
  • return
  • public void gotoLocation (Location newLoc )
  • currentLocation newLoc

22
Adding initialization
  • public class Car
  • private Location currentLocation
  • private java.util.Calendar builtDateprivate
    String state
  • private boolean gasAvailable
  • public Car ( )
  • state "stopped"
  • public void start ( )
  • if (gasAvailable) state "started"
  • return
  • ..
Write a Comment
User Comments (0)
About PowerShow.com