Sunteți pe pagina 1din 7

Object-Oriented Theme-

1) Abstraction:
• It means focusing on the essential aspects of an entity while ignoring its details.
• This means focusing on what an object is and does, before deciding how it should be
implemented.
• Use of abstraction during analysis means dealing only with application domain concepts, not
making decisions before problem is understood.
2) Encapsulation:
• It means information hiding. It consists of separating the external aspects of an object, which
are accessible to other objects, from internal implementation details of the object, which are
hidden from other objects.
• It prevents program from becoming so interdependent that a small change has massive ripple
effect. It gives the ability to combine data structure and behaviour in a single entity.
3) Combining Data and Behavior:
• The burden of calling code for data execution and operations separately can be minimized by
combining data properties and behavioural properties of an entity together.
• In object oriented program data structure and procedure is defined in single class definition.
4) Sharing:

• Object Oriented technologies promote sharing at different levels. Inheritance of both data
structure and behavior lets subclasses share common code.
• This sharing via inheritance is one of the main advantages of Object Oriented languages.
• Object Oriented Development not only lets you share information within an application but
also offers the prospect of reusing designs and code on future projects.

5) Emphasis on the essence of object:


• Object Oriented Technology stresses what an object is, rather than how it is used.
• The uses of an object depend on the details of the application and often change during
development.
6. Synergy:
• Identity, classification, polymorphism and inheritance characterize Object Oriented languages.
• Each of these concepts can be used in isolation but together they complement each other
synergistically.
Modeling- A model provides blueprint of the system.It is an abstract representation of a system. This
model representation promotes better understanding. Building a model is essential for
communication of a project team. Following are the advantages of models-
• helps in visualizing the system to be developed.
• Permits to specify the structure and behaviour of the system.
• Used as templet to construct a proposed system.
• Helps to master the complex system
• Make easy to enhance, and manipulation of existing system.

Abstraction-

Abstraction means to focus on the essential features of an element or object in OOP, ignoring its
extraneous or accidental properties. The essential features are relative to the context in which the
object is being used. The goal of abstraction is to isolate those aspects that are important for
some purpose and suppress those aspects that are not important.

Example − When a class Student is designed, the attributes enrolment_number, name, course,
and address are included while characteristics like pulse_rate and size_of_shoe are eliminated,
since they are irrelevant in the perspective of the educational institution.

Constraint-

A constraint is a packageable element which represent some conditions, restriction or assertion


related to some element or several elements. Constraint is usually specified by a Boolean expression
which must evaluate to a true or false. Constraint must be satisfied (i.e. evaluated to true) by a correct
design of the system. Constraints are commonly used for various elements on class diagrams.
In general there are many possible kinds of owners for a constraint. Owning element must have
access to the constrained elements to verify constraint. The owner of the constraint will determine
when the constraint is evaluated. For example, operation can have pre-condition and/or a post-
condition constraints.
Constraint could have an optional name, though usually it is anonymous. A constraint is shown as a
text string in curly braces according to the following syntax:
constraint ::= '{' [ name ':' ] boolean-expression '}'

Metadata-
Metadata is simply data about data. It means it is a description and context of the data. It helps to
organize, find and understand data. Here are a few real world examples of metadata:

These are some typical metadata elements:


1. Title and description,
2. Tags and categories,
3. Who created and when,
4. Who last modified and when,
5. Who can access or update.

State -
The state is an abstraction given by the values of the attributes that the object has at a particular
time period. It is a situation occurring for a finite time period in the lifetime of an object, in which it
fulfils certain conditions, performs certain activities, or waits for certain events to occur. In state
transition diagrams, a state is represented by rounded rectangles.
Parts of a state-
• Name − A string differentiates one state from another. A state may not have any name.
• Entry/Exit Actions − It denotes the activities performed on entering and on exiting the state.
• Internal Transitions − The changes within a state that do not cause a change in the state.
• Sub–states − States within states.
Initial and Final States-
The default starting state of an object is called its initial state. The final state indicates the completion
of execution of the state machine. The initial and the final states are pseudo-states, and may not
have the parts of a regular state except name. In state transition diagrams, the initial state is
represented by a filled black circle. The final state is represented by a filled black circle encircled
within another unfilled black circle.

Events-

Events are some occurrences that can trigger state transition of an object or a group of objects.
Events have a location in time and space but do not have a time period associated with it. An event
happens instantaneously with regard to time scale of an application. One event may logically precede
or follow another, or the two events may be unrelated. Events include error conditions as well as
normal conditions. Events are generally associated with some actions like mouse click, key press etc.
Events that trigger transitions are written alongside the arc of transition in state diagrams. Three types
of events:
• signal event
• change event
• time event.

Signal Event-
• A signal is an explicit one-way transmission of information from one object to another.
• It is different form a subroutine call that returns a value.
• An object sending a signal to another object may expect a reply, but the reply is a separate
signal under the control of the second object, which may or may not choose to send it.
• A signal event is the event of sending or receiving a signal (concern about receipt of a signal).

<<signal>> <<signal>> <<signal>>


StringEntered DigitDialed MouseButton Pushed

text digit button


location

Change Event-
• A change event is an event that is caused by the satisfaction of a Boolean expression.
• UML notation for a change event is keyword when followed by a parenthesized Boolean
expression.
 when (room temperature < heating set point )
 when (room temperature > cooling set point )
 when (battery power < lower limit )
 when (tire pressure < minimum pressure )

Time Event-
• Time event is an event caused by the occurrence of an absolute time or the elapse of a time
interval.
• UML notation for an absolute time is the keyword when followed by a parenthesized
expression involving time.
• The notation for a time interval is the keyword after followed by a parenthesized expression
that evaluates to a time duration.
• when (date = jan 1, 2000 )
• after (10 seconds )

State Diagram -
• A state diagram is a graph whose nodes are states and whose directed arcs are transitions
between states.
• A state diagram specifies the state sequence caused by event sequences.
• State names must be unique within the scope of a state diagram.
• All objects in a class execute the state diagram for that class, which models their common
behavior.
• A state model consists of multiple state diagrams one state diagram for each class with
important temporal behavior.
• State diagrams interact by passing events and through the side effects of guard conditions.
• UML notation for a state diagram is a rectangle with its name in small pentagonal tag in the
upper left corner.
• The constituent states and transitions lie within the rectangle.
• States do not totally define all values of an object.
• If more than one transition leaves a state, then the first event to occur causes the
corresponding transition to fire.
• If an event occurs and no transition matches it, then the event is ignored.
• If more than one transition matches an event, only one transition will fire, but the choice is
nondeterministic.
Nested State Diagram-

An activity in a state can be expanded as a lower-level state diagram, each state representing one step
of the activity. Nested activities are one-shot state diagrams with input and output transitions, similar
to subroutines. The set of nested state diagrams forms a lattice. (It is a tree if we expand different
copies of the same nested diagram.).

Problem with flat state diagrams-


Flat unstructured state diagram are impractical for large problems, because representing an object
with n independent Boolean attribute requires 2n states. By partitioning the state into n independent
state diagram requires 2n states only.
Expanding states -
• One way to organize a model is by having high level diagram with sub diagrams expanding
certain state. This is like a macro substitution in programming language
• A submachine is a state diagram that may be invoked as part of another state diagram

Example-
CONCURRENCY -
• State model supports concurrency among objects
• Object can act & change state independent of one another.
• Sometime objects shares constraints that causes their state changes

AGGREGATION CONCURRENCY –
The aggregate state corresponds to the combined states of all the parts. Aggregation is the "and-
relationship". Transitions for one object can depend on another object being in a given state. Figure 6
shows the state of a Car as an aggregation of part states: Ignition, Transmission, Accelerator, and
Brake (plus other unmentioned objects).

Concurrency within an Object-


• Some objects can be partitioned into subsets of attributes or links.
• Each of the partitioned subset has its own sub-diagram.
• The state of the object comprises one state from each sub-diagram.
• The sub diagrams need not be independent; the same event can cause transitions in more than
one sub-diagram
• UML Notation- partition the composite state into regions with dotted lines.
Synchronization of Concurrent Activities-
• Sometimes one object must perform two (or more) activities concurrently.
• The object must complete both activities before it can progress to its next state.

S-ar putea să vă placă și