Professional Documents
Culture Documents
Using
Modified Modeling Language
(UML)
Outline
What is a Model?
A model is a simplification of reality.
A model may provide
blueprints of a system
Organization of the system
Dynamic of the system
Why We Model
A successful software organization is
one that consistently deploys quality
software that meets the needs of its
users. An organization that can
develop such software in a timely and
predictable fashion, with an efficient
and effective use of resources, both
human and material, is one that has
sustainable business.
CS 3300 Object-OrienteObject-Oriented Model
Why We Model
Model is built to
Communicate the desired structure and
behavior of the system
Visualize and control the systems architecture
Better understand the system that being built
Manage risk
Expose opportunities for simplification and
reuse
Why We Model
We build models so that we can see
and better understand the system we
are developing.
Importance of Modeling
Models help us
to visualize a system as it is or as we
want it to be.
to specify the structure or behavior of a
system.
in providing a template that guides us in
constructing a system.
in providing documenting the decisions
we have made.
Principles of Modeling
The choice of what models to create has a
major influence on how a problem is
approached and how a solution is shaped.
Every model may be expressed at different
levels of precision.
The best models are connected to reality.
No single model is sufficient. Every
nontrivial system is best approached
through a small set of nearly independent
models.
CS 3300 Object-OrienteObject-Oriented Model
Objected-Oriented
Modeling
Two most common ways in modeling
software systems are
Algorithmic
Procedures or functions
Object oriented
Objects or classes
What is UML?
UML is a language for
Visualizing
Specifying
Constructing
Documenting
10
11
12
Object
Class
13
Objects
Each of object has a unique identity.
The state of an object is composed of a set of
fields (data fields), or attributes.
Each field has a name, a type, and a value.
Behaviors are defined by methods.
Each method has a name, a type, and a value.
Each method may or may not return a value.
Features are a combination of the state and the
behavior of the object.
14
Properties of Objects
Two objects are equal if their states are
equal.
Two objects are identical if they are the
same objects.
The values of the fields are mutable.
Methods that do not modify the state of
the object are called accessors.
Methods that modify the state of the
object are called mutators.
Objects can be mutable or immutable.
CS 3300 Object-OrienteObject-Oriented Model
15
Classes
A class defines a template for
creating or instantiating its instances
or objects.
A class is a description of a set of
objects that share the same
attributes, operations, relationships,
and semantics.
CS 3300 Object-OrienteObject-Oriented Model
16
Classes
A class defines --
17
Example
Class name: Point class Point {
Fields:
x, y
int x, y;
Method:
move
public void move
(int dx, int dy){
// implementation
}
18
fieldn
method1
methodm
19
Field Declaration
The name of the field is required in the field
declaration.
Field declaration may include:
[Visibility][Type]Name[[Multiplicity]][=InitialValue]
[Visibility]Name[[Multiplicity]][:Type][=InitialValue]
20
Visibility syntax
in Java and UML
Visibilty
Java Syntax
UML Syntax
public
public
protected
protected
package
private
~
private
21
Examples
Java Syntax
UML Syntax
Date birthday
Birthday:Date
+duration:int = 100
Private Student
students[0..MAX_Size]
-students[0..MAX_Size]:Student
22
Method Declaration
The name of the method is required
in the method declaration.
Method declaration may include:
[Visibility][Type]Name([Parameter, ...])
[Visibility]Name([Parameter, ...])[:Type]
23
Examples
Java Syntax
UML Syntax
+int getSize()
24
Example
Point
Point
private int x
private int y
-x:int
-y:int
+move(dx:int,dy:int)
Point
x
y
move()
25
fieldn = valuen
26
Examples
P1:Point
x = 0
y = 0
P1:Point
x = 24
y = 40
p1.x = 0;
P1.y = 0;
27
Message Passing or
Method Invocation
Objects communicate with one
another through message passing.
A message represent a command sent
to an object -- recipient
A message consists of the receiving
object, the method to be invoked and
the arguments to method.
CS 3300 Object-OrienteObject-Oriented Model
28
Example
Recipient
p1.move(10,20) Method
p1
move()
Arguments (10,20)
CS 3300 Object-OrienteObject-Oriented Model
29
Packages
Package name are in lower case -Java.awt.event
javax.swing.*
30
31
Principles
Modularity:
Abstraction:
Encapsulation:
Information hiding
Polymorphism:
Portability
Levels of Abstraction:
32
Principle of Modularity
A complex software system should be decomposed
into a set of highly cohesive but loosely coupled
modules.
The basic for decomposition are cohesion and
coupling.
Cohesion -- functional relatedness of the entities within
modules.
Coupling inter-dependency among different modules.
33
Principle of Abstraction
The behaviors or functionalities
should be precisely characterized as
contractual interface which captures
the essence of the behavior.
The complexity of the module is
hidden from the clients.
34
Principle of Encapsulation
The implementation of a module
should be separated from its
contractual interface and hidden
from the clients of the module.
Information hiding
35
Principle of Polymorphism
Ability to interchange modules
dynamically without affecting the
system.
refers to a contractual interface with
multiple interchangeable
implementation
36
37
Inheritance
Define a relationship among classes
and interfaces
Inheritance model -- the is-a(n)
relationship
38
Example
39
Principle of Levels of
Abstraction
Abstractions can be organized into
different levels.
Higher level is more general
40
Association
Association represents binary
relationship between classes
Student
advisee
*
* enroll
Course
*
teach
1
adviser
1
Faculty
41
42
Example
University
College
Department
Student
Member-of
1..*
Chairman-of
Faculty
43
Dependency
Dependency is a relationship between
entities such that the proper
operation of one entity depends on
the presence of the other entity, and
changes in one entity would affect
the other entity.
44
Example
CourseSchedule
Registrar
void addCourse(CourseSchedule a, Course c)
void removeCourse(CourseSchedule Course
findCourse(String title)
void enroll(Course c, Student s)
void drop(Course c, Student s
Course
Student
45
46
Example
47
exit/Action2
CS 3300 Object-OrienteObject-Oriented Model
48
Graphical notations
49
50
Example
talk
51
52
53
Extension relationships
among actors
54
Dependency relationships
among use cases
55
Identifying classes
Identifying the features of classes -states and behaviors
Identifying relationships among classes
inheritance and interfaces.
56
Requirements
Allow customers to browse and order
books, music CDs, and computer
software
57
Specifications
Provide information on the books, CDs, and
software
Provide a functionality for customers
registration as well as updating customers
information
Provide a functionality for ordering and
shipping
Provide a functionality for updating
inventory
CS 3300 Object-OrienteObject-Oriented Model
58
Register
Customer
Logon
Manager
Manage
catalog
Shop
Catalog
Manager
Manage
Acount
System
administrator
Process
order
Inventory
manager
59