To Object-Oriented Modeling Techniques
To Object-Oriented Modeling Techniques
to
Object-Oriented Modeling techniques
Objects
Links
CLASS DIAGRAM
A graphical representation used for modeling classes and their
relationships.
Describes all possible objects belonging to the classes.
Used for abstract modeling and for implementing actual program
The class diagram is concise and can be understood easily.
Classes are interconnected by association lines.
OMT Dynamic Model
States, transitions, events and actions.
Concerned with the time and sequencing of the operations of the
object.
Captures control aspect of the system.
Represented by state transition diagram.
STATE TRANSITION DIAGRAM(1)
State:
Some behavior of a system that is observable and that lasts for some period of
time.
Transition:
(Virtually) instantaneous change in state (behavior).
STATE TRANSITION DIAGRAM(2)
A condition is typically some kind of event, e.g.:
Signal
Arrival of an object (data/material)
An action is the appropriate output or response to the event, e.g.:
Signal or message
Transfer of an object,
Calculation
State Transition Diagram
FUNCTIONAL MODEL
It describes how one object collaborates with other in order to
achieve behavior of the system.
Overall behavior of system represented with the help of dynamic and
functional model.
Includes use case diagram, sequence diagram and activity
diagram.
Represented by data flow diagram.
The functional model includes:
The functional model describes how the objects interact with each other.
All four components of functional model can be related to object model:
Processes: These are the methods implemented in the objects.
Actors: These are the objects in the object model.
Data stores: These are also objects in the object model or attributes of
objects.
Data flows: These are values in the object model. Data flows to or from
actors represent operations on or by objects. Data flows to or from data
stores represent queries or updates.
Dynamic and functional model
***
Abstract Data Types
Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined
by a set of value and a set of operations.
ADT only mentions what operations are to be performed but not how these
operations will be implemented. It does not specify how data will be organized in
memory and what algorithms will be used for implementing the operations.
Const Keyword
Constant is something that doesn't change. In C and C++ we use the
keyword const to make program elements constant. const keyword can be used
in many contexts in a C++ program. It can be used with:
Variables
Pointers
Function arguments and return types
Class Data members
Class Member functions
Objects
Defining Class Object as const
When an object is declared or created using the const keyword, its data members
can never be changed, during the object's lifetime.
Syntax:
const class_name object;
For example, if in the class Test defined above, we want to define a constant
object, we can do it like:
const Test r(30);
Example for const Object and const Member function
int falcon() const // constant function cout << objOne.i << objTwo.i;
{
/* objOne.gamma(); // No error
can do anything but will not objTwo.gamma(); // Compile time error
modify any data members }
*/
cout << "Falcon has left the Base";
}
int gamma()
{
i++;
}
};