Joseph 15SE203UnitII
Joseph 15SE203UnitII
Joseph 15SE203UnitII
Examples:
• System: Aircraft
• Models: Flight simulator, scale model
• Views: All blueprints, electrical wiring, fuel system
Systems, Models and Views
Flightsimulator
Blueprints
Aircraft
Model 2
View 2
View 1
System
View 3
Model 1
Electrical
Wiring
Scale Model
UML Models, Views, Diagrams
• UML is a multi-diagrammatic language
– Each diagram is a view into a model
• Diagram presented from the aspect of a particular stakeholder
• Provides a partial representation of the system
• Is semantically consistent with other views
– Example views
Models, Views, Diagrams
Basic Modeling Steps
• Use Cases
– Capture requirements
• Domain Model
– Capture process, key classes
• Design Model
– Capture details and behaviors of use cases and
domain objects
– Add classes that do the work and define the
architecture
UML Baseline
• Use Case Diagrams
• Class Diagrams
• Package Diagrams
• Interaction Diagrams
– Sequence
– Collaboration
• Activity Diagrams
• State Transition Diagrams
• Deployment Diagrams
Summary and Tools
• UML is a modeling language that can be used independent of
development
• Adopted by OMG and notation of choice for visual modeling
– http://www.omg.org/uml/
• Creating and modifying UML diagrams can be labor and time
intensive.
• Lots of tools exist to help
– Tools help keep diagrams, code in sync
– Repository for a complete software development project
– Examples here created with TogetherSoft ControlCenter, Microsoft
Visio, Tablet UML
– Other tools:
• Rational, Cetus, Embarcadero
• See http://plg.uwaterloo.ca/~migod/uml.html for a list of tools, some
free
Questions
• Expand UML…………. Give its latest version.
• Identify organization that uses UML approach.
• Mentions at least three tools that uses UML
approach.
• Compare and contrast Data Flow Diagram Vs.
UML Diagram.
Session 2
Use Cases
Use Cases
• Use Cases:
– Text stories
• Some “actor” using system to achieve a goal
– Used to discover and record requirements
– Serve as input to later phases of development
– Emphasizes user goals and perspective
• Not system implementation choices and details
– A way of specifying functional requirements
• Example: Process sale (Brief, informal format)
Use Cases
• Use cases are text, not diagrams
– UML use case diagrams are auxiliary
• Definitions:
– Actor: Something with behavior
• A person (user)
• A computer system
• An organization
– Scenario: A specific sequence of actions and interactions
between actors and the system
• Also called a “use case instance”
• One particular story of using a system
• One path through the use case
– A use case: A collection of related success and failure
scenarios that describe an actor using a system to achieve
a goal.
Use Cases
– A use case (Informal format)
Checkout Service
Sales Tax
Agency
POS System
Goal: Collect
taxes on sales Sales Activity
System Cashier
Customer
«actor»
Cash In Accounting
System
Manager
«actor»
«actor» Analyze Activity
HR System
Sales Activity
System
Manage Security
NextGen
«actor»
Process Sale Payment
Authorization
Service
Cashier
...
Play Monopoly
Game
Observer
Monopoly Game
• Very simple use case diagram and text
• Most detail is deferred to Supplementary
Specification (SS)
– Domain rules listed in SS
Use Cases in Iterative Methods
• Functional requirements recorded in use cases
• Important part of iterative planning
– Work of an iteration decided by choosing use case
scenarios or entire use cases
• Use cases influence organization of user manuals
• Testing builds on use case scenarios
• Iterative interplay between
– Requirements discovery
– Building parts of system
When Where
Once during inception. Short; do not try to At a requirements workshop.
define or polish all requirements.
January February
System
Analyst Customer
Software
End User Developer Architect
How: Tools
Who Software:
Many, including end users and developers, will play For use case text, use a web-enabled requirements tool
the role of requirements specifier, helping to write that integrates with a popular word processor.
use cases. For use case diagrams, a UML CASE tool.
Hyperlink the use cases; present them on the project website.
Led by system analyst who is responsible for
requirements definition. Hardware: Use two projectors attached to dual video cards and
set the display width double to improve the spaciousness of the
drawing area or display 2 adjacent word processor windows .
Questions
Session 3
Domain Model
Visualizing Concepts
52
Comments on diagrams
• Now that we are starting to look at diagrams, I
want to emphasize that this is a class on
analysis and design, not diagramming. While
it may look good on your resume that you can
use UML, your career depends on being able
to translate ideas into good systems. That is
much more difficult.
53
Domain Model Relationships
Business Model
Domain Model
Classes, attributes, associations
Requirements
Interaction Diagrams
Design
54
A Domain Model
• illustrates meaningful conceptual classes in a
problem domain.
• is a visual representation of real-world
concepts, not software components.
• also called Conceptual model
• is NOT a set of diagrams describing software
classes, or software objects and their
responsibilities.
55
A Domain Model is the most
important OO artifact
57
A Domain Model is not a Software
Artifact
Sale SalesDatabase
59
Decomposition:
60
Conceptual Class Identification:
65
Apply the
Mapmaker Strategy
66
A Common Mistake -
Classes as Attributes
68
Description of a Service Example
(Flight)
Flight
Date Airport
Flies-to
Time Name
Number vs.
69
Monopoly Concepts (candidates)
70
UML Notation: Multiple
Perspectives
• UML describes raw diagram types, such as class
diagrams. It does not impose a specific method or
process.
• UP, the Unified Process, applies raw UML to defined
methodology models.
UML can be used for 3 different perspectives:
• Essential – describe the real world
• Specifications – software abstractions, such as
components and their interfaces
• Implementation – specific language (Java)
71
Questions
• Define domain model.
• List the association guidelines.
• Mention some conceptual classes.
• How domain model can be used in Interaction
Diagram?
72
Session 4
Tutorial- Use Case and Class Diagram
Objectives
• Describe system behavior and show how to
capture it in a model.
• Demonstrate how to read and interpret:
– A use-case diagram
Where Are We?
• Concepts in use-case modeling
• Use-case diagrams
What Is System Behavior?
• System behavior is how a system acts and
reacts.
– It is the outwardly visible and testable activity of a
system.
• System behavior is captured in use cases.
– Use cases describe the system, its environment,
and the relationship between the system and its
environment.
What Is a Use-Case Model?
• A model that describes a
system’s functional View Report Card
requirements in terms of
use cases. Student
Register for Courses
Identification
Users
End User Domain Expert
Major Concepts in Use-Case Modeling
• An actor represents anything
that interacts with the system.
Actor
Use Case
Use Cases and Actors
• A use case models a dialog between actors and
the system.
• A use case is initiated by an actor to invoke a
certain functionality in the system.
Student
Register for Courses Maintain Professor Information
Course Catalog
Login
Maintain Student Information
Select Courses to Teach
Registrar
Professor
Billing System
Review
• What is system behavior?
• What is a use-case model? What are
its benefits?
• What is an actor? A use case?
Schedule
CloseRegistrationForm CloseRegistrationController
Professor
Student
Course CourseOffering
CourseCatalogSystem
BillingSystem
Review: What Is a Package?
• A general purpose mechanism for organizing
elements into groups.
• A model element that can contain other
model elements.
University
Artifacts
Registration
CloseRegistrationForm CloseRegistrationController
RegisterForCoursesForm RegistrationController
Where Are We?
Class diagrams
Class relationships
Association
Aggregation
Generalization
What Is an Association?
• The semantic relationship between two or more
classifiers that specifies connections among their
instances.
• A structural relationship specifying that objects
of one thing are connected to objects of another
thing.
<<entity>> <<entity>> <<entity>>
Student Schedule Course
Example: What Associations Can You
Find?
1: submit schedule( )
: RegisterForCoursesForm
2: submit schedule( )
: RegistrationController
: Student
8: any conflicts?( )
3: save( )
4: submit( )
6: has pre-requisites(CourseOffering)
:CourseOffering
:Student
5: is selected?( )
10: mark as enrolled in( )
:PrimaryScheduleOfferingInfo
What Is Multiplicity?
• Multiplicity is the number of instances one class
relates to ONE instance of another class.
• For each association, there are two multiplicity
decisions to make, one for each end of the association.
– For each instance of Professor, many Course Offerings may
be taught.
– For each instance of Course Offering, there may be either
one or zero Professor as the instructor.
<<entity>> <<entity>>
instructor
Professor CourseOffering
0..1 0..*
Multiplicity Indicators
Unspecified
Exactly One 1
Zero or More *
0..1
0..1
0..1
Example: Aggregation
<<boundary>> <<control>>
1
RegisterForCoursesForm RegistrationController
1
0..1
0..1
+ withdraw()
+ createStatement()
Generalization
Relationship
Savings Checking
Subclasses
Descendents
Example: Multiple Inheritance
• A class can inherit from several other classes.
FlyingThing Animal
Multiple Inheritance
116
117
118
119
120
121
122
Class diagram
Association
123
Directed Association
124
Reflexive Association
125
Aggregation
126
Composition
127
7. Generalization/Inheritance
known as an “is a” relationship since the child class is a type of the parent
class.
128
Questions
Session 6-Relationship in Use Case and
Class Diagram
Relationship in Use Case and Class
Diagram
Class Diagram Use Case Diagram
- Class Notation - Use Cases under the Microscope
- Object Diagram - Uses and Extends Associations
- Class Interface Notation - Association between actor and use case
- Binary Association Notation - Extend between two use cases
- Association Role - Include between two use cases
- Qualifier - Generalization of a use case
- Multiplicity - Generalization of an actor
- OR Association
- Association Class
- N - Ary Association
- Aggregation and Composition
- Generalization
Classes
A class is a description of a set of objects that share the same attributes,
operations, relationships, and semantics.
ClassName
attributes
operations
Object Diagram
• A static object diagram is an instance of a class
diagram.
• Shows a snapshot of the detailed state of the system
at a point in time, Notation is the same for an object
diagram and a class diagram.
Class Interface Notation
• Class interface notation is used to describe the
externally visible behavior of a class.
Ex: An Operation with public visibility
Binary Association Notation
• A binary association is drawn as a solid path connecting two
classes, or both ends may be connected to the same class.
• An association may have an association name,
end of an association, where it connects to a class, is called the
association role. See below Figure:
Association Role
• A simple association- the technical term for it is binary association- is
drawn as a solid line connecting two class symbols.
• The end of an association, where it connects to a class, shows the
association role.
Qualifier
• A Qualifier is an association attribute.
• For example, a person object may be associated to a Bank object. An
attribute of this association is the account#. The account# is the qualifier of
this association.
• The Figure depicts association qualifier
and its multiplicity.
Multiplicity
• Multiplicity specifies the range of allowable associated classes. It is given
for roles within associations, parts within compositions, and other purposes.
• The terms lower bound and upper bound are integer values, specifying the
range of integers including the lower bound and upper bound.
0………1
0………*
1…3, 7….10, 15, 19,----*
OR Association
• An OR association indicates a situation in which only one several potential
associations may be instantiated at one time for any single object.
• Shown as a dashed line connecting two or more associations, all of which
must have a class in common with the constrained string labeling the
dashed line.
Figure:
An OR association notation. A car may
associate with a person or a company.
Association Class
• An association class is an association that also has class properties. An
association class is shown as a class symbol attached by a dashed line to an
association path.
N - Ary Association
Generalization
• Generalization is the relationship between a more general class
and a more specific class.
• Shown as a directed line with a closed, hollow arrowhead at the
superclass end.
Use case Diagram
• A Use Case diagram is a graph of actors, a set of use cases
enclosed by a system boundary, communication associations
between the actors and the use cases, and generalization
among the use cases.
• These relationships are
shown in a use case diagram
i) Communications
ii) Uses
iii) Extends
Use Cases under the Microscope
• Use Case
• Actors
• In a System
• A measurable value
• Transaction
• Use-case name
Uses and Extends Associations
• The extends association is used when you have one use case
that is similar to another use case but does a bit more or is more
specialized.
• The uses association occurs when you are describing your use
cases and notice that some of them have subflows in common.
Association between actor and use case
• An actor must be associated with at least one use case.
• An actor can be associated with multiple use cases.
• Multiple actors can be associated with a single use case.
Generalization of an Actor
• Generalization of an actor means that one actor can inherit the role of an
other actor. The descendant inherits all the use cases of the ancestor. The
descendant have one or more use cases that are specific to that role.