Vous êtes sur la page 1sur 18

The three models

A typical software procedure incorporates


following all three aspects
It uses data structures (class model)
It sequences operations in time (state model)
It passes data and control among objects
(interaction model)
Each model contains references to entities in
other models

Each of the three models evolves


during development
First analysts construct a model of the
application without regard for eventual
implementation
Then designers add solution constructs
to the model.
Implementers code both application
and solution constructs

The word model has two dimensions


A view of a system (class, state or
interaction model)
A stage of development (analysis,
design or implementation)

Class Modeling

Objects
The purpose of class modeling is to
describe objects
An object is a concept, abstraction or thing
with identity that has meaning for an
application
The choice of objects depends on judgment
and nature of a problem; there can many
correct representations
All objects have identity and are
distinguishabe

Classes
A class describes a group of objects with same
properties, behavior, kinds of relationships and
semantics
The interpretation of semantics depends on the
purpose of each application and is a matter of
judgment
Objects class are determined at run time.
By grouping objects into classes, we abstract a
problem. Abstraction gives modeling its power and
ability to generalize from a few specific cases to a
host of similar cases. We can write operations once
for each class, so that all objects in the class benefit
from code reuse

Class Diagrams
Class diagrams provide a graphic notation for
modeling classes and their relationships, thereby
describing possible objects
They are useful for both abstract modeling and
for designing actual programs
Object diagrams shows individual objects and
their relationships
They are useful for documenting test cases and
discussing examples
A class diagram corresponds to an infinite set of
objects

Class

Stude
nt

Objects

Ram :
Student

Seema :
Student

Values and Attributes


A value is a piece of data
An attribute is a named property of a class
that describes a value held by each object
of the class
Object is to class as value is to attribute
Some implementation media require that
an object have a unique identifier
License plate number, telephone number
etc, are not internal identifiers because
they have meaning in the real world

Class with attributes

Perso
n
Name : String
Birth_date: date

Objects with values

Ram:
Person
Name = Ram
Birth_date = 21
october 92

Operations and Methods


An operation is a function or
procedure that may be applied to or
by objects in a class
Ex: Open, close, hide and display are
operations on class window
All objects in a class share the same
operations
Polymorphism: same operations
takes on different forms in different
classes

A method is the implementation of an


operation for a class
Ex: class File may have an operation print.
We can implement using different methods
like print ASCII files, print binary files etc
When an operation has methods on several
classes, it is important that the methods all
have same signature the number and type
of arguments, and the type of result value

UML Notation
GeometricOb
ject

Color
Position

Move ( delta : Vector)


Select ( p: Point) :
Boolean
Rotate ( in angle : float
= 0.0)

ClassName
attributeName1 : dataType1 =
defaultValue1
.
operationName1 (argumentList1) =
resultType1
.
.

Notation for an argument of an


operation

direction argName : type = default


Value
Direction indicates whether an
argument is an input (in), output
(out) or an input argument that can
be modified (inout)