UML by J'P'Nytun, page 1 - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

UML by J'P'Nytun, page 1

Description:

From Wikipedia, the free encyclopedia: ... In physics the system under study is nature (which. is given); the mission is to come up with a description ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 24
Provided by: janpetter
Category:

less

Transcript and Presenter's Notes

Title: UML by J'P'Nytun, page 1


1
Jan Pettersen NytunAgder University
CollegeNorwayhomepage http//ikt.hia.no/janpn
/Slides can be found on home page (bottom of
page)Email Jan.P.Nytun at hia.no
2
(No Transcript)
3
Agder University Collegehttp//www.hia.no/english
/
  • The countrys fifth largest institution of
    higher education
  • 7000 students with campuses in
  • Kristiansand
  • Grimstad
  • Over 100 different studies

4
(No Transcript)
5
Modeling UML
  • What is a model?
  • Interpretation of a model
  • describedBy or specifiedBy
  • UML
  • UML Diagrams
  • Class and object diagrams
  • The Object Constraint Language - OCL

6
What is a model?
  • From Wikipedia, the free encyclopedia
  • Model, models, or modeling may refer to An
    abstract representation of an object or system
    from a particular viewpoint.
  • Some other definitions
  • "A model is an abstraction of a physical system,
    with a certain purpose.
  • "A model is a simplification of a system built
    with an intended goal in mind. The model should
    be able to answer questions in place of the
    actual system.
  • "A model is a set of statements about some system
    under study (SUS)."

7
Modeling is essential 2
  • Modeling is essential to human activity because
    every action is preceded by the construction
    (implicit or explicit) of a model.
  • The medical technique of bloodletting was based
    on an incorrect model of the body. If the model
    is incorrect, the action may be inappropriate.
  • Hyppocrates and many others believed that the
    four crucial elements earth, air, water and fire
    were balanced within the human body as the four
    humors blood, phlegm, and black and yellow bile.
    In this context, disease was due to an imbalance
    in the four humors and treatment involved
    restoring their balance through bloodletting.
  • Georges Washington died after heavy blood loss
    sustained in a bloodletting treatment for
    laryngitis.

8
Model and Model Instance
Model
Model
specifiedBy
describedBy
The specifiedBy role is a specialization of
the describedBy role.
given
specifies
System
System
In physics the system under study is nature
(which is given) the mission is to come up with
a description (model) that is so good that it can
be used to predict and explain natural phenomenon.
The specification of a software systemthe
implementation (system) must conform to the model.
A system is a group of interacting, interrelated,
or interdependent elements that form a
complex whole.
Person
Car
Car
Person

1
nameBob
name
Car
Model
A Model Instance snapshot
9
The Unified Modeling Language UML
  • The UML is a language for
  • visualizing
  • specifying
  • constructing
  • documenting
  • the artifacts of a software-intensive system.

10
There are 13 types of diagrams in UML 2.0
Use CaseDiagrams
ActivityDiagrams
Package Diagrams
DeploymentDiagrams
ClassDiagrams
Component Diagrams
Composite StructureDiagrams
StatemachineDiagrams
ObjectDiagrams
Model
TimingDiagrams
SequenceDiagrams
Interaction OverView Diagrams
Commun- icationDiagrams
Communication diagrams was called Collaboration
diagram in UML 1.x
11
UML Class Diagram Example from 1
12
The Instantiation Theoryof UML
The connection between class and object diagrams.
13
Object Diagram withLinks and Slots
Class Diagram
Object Diagram
Gimlemoen Office
Slot
LocatedAt
Department
Company
nameLanguage
1
HiA Company
1..
Possibleobject diagram
LocatedAt
Department
Office

1..
nameString
Grooseveien Office
LocatedAt
Department
nameEngineering
Link - A link is an instance of an
association,analogous to an object being an
instance of a class.
14
A Class Diagram Mapped to Java
public class Person protected String name
protected String imail protected String
homePage
Person
name String imail
String homePage String
public class Student extends Person // //
Navigation public Course course
Student


Course
public class Course
15
The History of OCL
  • Formal Languages like Z, have for a long time
    (ca. 1970) been used to describe things in a
    precise and unambiguous way.
  • OCL is influenced by Syntropy. Syntropy is based
    on a combination of OMT and a subset of Z.
  • OCL was developed by IBM (1995) (Formally
    defined 1997.)It emphasize precision and
    simplicity. There is no use of special
    mathematical symbols.
  • OCL 2.0 is now arriving.

16
Constraint
3 A semantic condition or restriction
represented as an expression.In general, a
constraint can be attached to any model
element.A constraint is an assertion, not an
executable mechanism. It indicates a restriction
that must be enforced by correct design of the
system.An inherited constraint may not be set
aside or superseded
17
Why OCL?
  • The graphical language of UML is not always
    suited for specifying constraints!
  • OCL give you power to improve the documentation
    in a precise (OCL is a formal language) and
    unambiguous way (in contrast to natural
    language).
  • OCL parsers can be used to ensure that the
    constraints are meaningful and well formed within
    the model.
  • To do MDA the models have to be unambiguous.

18
Where To Use OCL?
  • Invariants on classes and types
  • Precondition and postconditions on operations
    (methods)
  • Constraints on operations
    operationexpression (the return value)
  • Guards
  • Type invariant for Stereotypes

19
Invariant
  • A constraint that is connected to a modeling
    element, e.g. a class.
  • The invariant must be true at all times when the
    object is at rest.An object is not at rest when
    an operation is under execution.

SomeClass
ltltinvariantgtgtsome boolean expression
20
Navigation
You can use OCL to specify navigation paths
through object structures and declare constraints
(restrictions) on these structure.
21
Navigation Example
Model
alternative
Quiz
Question
AnswerAlternative


1..

contex Quiz inv self.question.alternative
self.question.alternative
self.question
self
quiz1Quiz
q1Question
a1AnswerAlternative
a2AnswerAlternative
ModelInstance
q2Question
a3AnswerAlternative
self
self.question
self.question.alternative
quiz2Quiz
q3Question
a4AnswerAlternative
22
Invariant, Precondition and Postcondition Example
Gang
name String
GangMember
member
isArmy Boolean
1..
1..
0..
0..
register(newMember GangMember)
-- The context of OCL-expressions is
underlined.-- The gang is an army if there are
more than 100 members.GangisArmy
(member-gtsize() gt 100) -- The gang has grown with
one when a new member is added.Gang
register(newMember GangMember)pre not
member-gtincludes(newMember)post member
member_at_pre-gtincluding(newMember)
23
References
  • 1 UML 1.5 Specification http//www.omg.org/tech
    nology/documents/formal/uml.htm
  • 2 Jean Bézivin. On the unification power of
    models http//www.sciences.univ-nantes.fr/lina/at
    l/www/papers/OnTheUnificationPowerOfModels.pdf
  • 3 James Rumbaugh , Ivar Jacobson, Grady Booch
    The Unified Modeling Language Reference
    Manual.Addison-Wesley, 1999
Write a Comment
User Comments (0)
About PowerShow.com