Ooad Unit 22

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 43

OBJECT ORIENTED

ANALYSIS AND DESIGN


(OOAD)
UNIT-2
Importance of Modeling

Importance of Modeling:

Why do we model?

A model is a simplification at some level of abstraction We build


models to better understand the systems we are developing.

To help us visualize

To specify structure or behavior

To provide template for building system

To document decisions we have made


Principles of Modeling

The models we choose have a profound(deep) influence on


the solution.

Every model may be expressed at different levels of


abstraction

The best models are connected to reality

No single model is sufficient, a set of models is needed to


solve any nontrivial system
Object Oriented modeling
Two most common ways in modeling software systems are

• Algorithmic - Procedures or functions


• Object oriented - Objects or classes
Object-oriented modeling (OOM) is the construction of objects using a collection of
objects that contain stored values of the instance variables found within an object.

The object-oriented modeling approach creates the union of the application and
database development and transforms it into a (uml) unified data model and language
environment.

Object-oriented modeling allows for object identification and communication while


supporting data abstraction, inheritance and encapsulation.

Object-oriented modeling is the process of preparing and designing what the


model’s code will actually look like. During the construction or programming phase, the
modeling techniques are implemented by using a language that supports the object-
oriented programming model.

OOM consists of progressively developing object representation through three


phases: analysis, design, and implementation.

During the initial stages of development, the model developed is abstract because the
external details of the system are the central focus. The model becomes more and
more detailed as it evolves, while the central focus shifts toward understanding how
the system will be constructed and how it should function.
Object oriented modeling is entirely a new way of thinking about problems. This
methodology is all about visualizing the things by using models organized around
real world concepts.

Object oriented models help in understanding problems, communicating with


experts from a distance, modeling enterprises, and designing programs and
database.

Object oriented models are represented by diagrams. A good model always helps
communication among project teams, and to assure architectural soundness.

Object Oriented Modeling is a suitable modeling technique for handling a complex


system. OOM basically is building a model of an application, which includes
implementation details of the system, during design of the system.

In OOM the modeling passes through the following processes: • System Analysis
• System Design • Object Design, and • Final Implementation.
The Unified Modeling Language (UML) is a standard visual language for describing
and modelling software blueprints. The UML is more than just a graphical language.
Stated formally, the UML is for: Visualizing, Specifying, Constructing, and
Documenting.
A Conceptual Model:
A conceptual model of the language underlines the three major elements:
• The Building Blocks • The Rules • Some Common Mechanisms
Building blocks
1.Things:
Things are the abstractions that are first-class citizens in a model; relationships tie these things
together; diagrams group interesting collections of things.
There are 4 kinds of things in the UML:1. Structural things (nouns of uml – static
parts) 2. Behavioral things (verbs of uml – dynamic parts) 3. Grouping
things (organizational parts) 4. Annotational things (explanatory parts)

These things are the basic object-oriented building blocks of the UML. You use them to write
well-formed models.

1.Structural things

Represents the static aspects of a software system. There are seven structural things in
UML. They are:

Class: A class is a collection of similar objects having similar attributes, behavior,


relationships and semantics. Graphically class is represented as a rectangle with three
compartments.
Graphical representation:

Example:
Interface: An interface is a collection of operation signatures and/or attribute
definitions that ideally define a cohesive set of behavior. Graphically interface is
represented as a circle or a class symbol stereotyped with interface.

Graphical Representation:

An interface is similar to a template without implementation details.


A circle notation represents it. When a class implements an interface,
its functionality is also implemented.

Use Case: A use case is a collection of actions, defining the interactions between a
role (actor) and the system. Graphically use case is represented as a solid ellipse
with its name written inside or below the ellipse.

Graphical Representation
Collaboration: A collaboration is the collection of interactions among objects to
achieve a goal. Graphically collaboration is represented as a dashed ellipse. A
collaboration can be a collection of classes or other elements.
Interaction Diagram are used in UML to establish communication between
objects.
Graphical Representation:

Component: A component is a physical and replaceable part of a system.


Graphically component is represented as a tabbed rectangle. Examples of
components are executable files, dll files, database tables, files and documents.
Node: A node is a physical element that exists at run time and represents a
computational resource. Graphically node is represented as a cube. Examples of
nodes are PCs, laptops, smartphones or any embedded system.

Example:

Active Class: A class whose objects can initiate its own flow of control
(threads) and work in parallel with other objects. Graphically active class is
represented as a rectangle with thick borders.

Example:
2. Behavioral Things

Represents the dynamic aspects of a software system. Behavior of a software


system can be modeled as interactions or as a sequence of state changes.

Interaction: A behavior made up of a set of messages exchanged among a set of


objects to perform a particular task. A message is represented as a solid arrow.
Below is an example of interaction representing a phone conversation:
State Machine: A behavior that specifies the sequences of states an object or
interaction goes through during its’ lifetime in response to events. A state is
represented as a rectangle with rounded corners. Below is an example of state
machine representing the states of a phone system:

3. Grouping Things

Elements which are used for organizing related things and relationships in models.

Package: A general purpose mechanism for organizing elements into groups.


Graphically package is represented as a tabbed folder. When the diagrams become
large and cluttered, related are grouped into a package so that the diagram can become
less complex and easy to understand.
Example:

4. Annotational Things
A symbol to display comments. Graphically note is represented as a rectangle with
a dog ear at the top right corner.
Relationships
The things in a diagram are connected through relationships. So, a relationship is a
connection between two or more things.
1. Dependency:

A dependency is a using relationship that states that a change in specification of


one thing (for example, class Event) may affect another thing that uses it (for
example, class Window), but not necessarily the reverse. • Graphically, a
dependency is rendered as a dashed directed line
2. Association: A structural relationship describing connections between two or
more things. Graphically represented as a solid line with optional stick arrow
representing navigation.

Example:

There are four adornments that apply to associations.

Name
An association can have a name, and you use that name to describe the nature of
the relationship. So that there is no ambiguity about its meaning, you can give a
direction to the name by providing a direction triangle that points in the direction you
intend to read the name, as shown in Figure

There are four adornments that apply to associations.


Role
• When a class participates in an association, it has a specific role that it plays in
that relationship;
• A role is just the face the class at the near end of the association presents to
the class at the other end of the association.
Multiplicity
• An association represents a structural relationship among objects. In many
modeling situations, it's important for you to state how many objects may be
connected across an instance of an association.

• This "how many" is called the multiplicity of an association's role, and is written as
an expression that evaluates to a range of values or an explicit value as in Figure
Aggregation

A plain association between two classes represents a structural relationship


between peers, meaning that both classes are conceptually at the same level, no
one more important than the other.

• Sometimes, you will want to model a "whole/part" relationship, in which one


class represents a larger thing (the "whole"), which consists of smaller things (the
"parts"). This kind of relationship is called aggregation, which represents a "has-a"
relationship.
3. Generalization: Is a generalization-specialization relationship. Simply put this
describes the relationship of a parent class (generalization) to its subclasses
(specializations). Also known as “is-a” relationship.
A generalization is a relationship between a general thing (called the super class or parent)and a
more specific kind of that thing (called the subclass or child).

4. Realization: Defines a semantic relationship in which one class specifies


something that another class will perform. Example: The relationship between an
interface and the class that realizes or executes that interface.
Diagrams
A diagram is a collection of elements often represented as a graph consisting of
vertices and edges joining these vertices. These vertices in UML are things and the
edges are relationships. UML includes nine diagrams:

1) Class diagram 2) Object diagram 3) Use case diagram 4) Component diagram


5) Deployment diagram 6) Sequence diagram 7) Collaboration diagram 8)
Statechart diagram and 9) Activity diagram.

Rules
The rules of UML specify how the UMLs building blocks come together to develop
diagrams. The rules enable the users to create well-formed models. A well-formed
model is self-consistent and also consistent with the other models.
UML has rules for:
Names – What elements can be called as things, relationships and diagrams
Scope – The context that gives a specific meaning to a name
Visibility – How these names are seen and can be used by the other names
Integrity – How things properly relate to one another
Execution – What it means to run or simulate a model
Common Mechanisms
Stereotypes, tagged values, and constraints are the mechanisms provided by the
UML to add new building blocks, create new properties, and specify new
semantics.

• For example, if you are modeling a network, you might want to have symbols for
routers and hubs; then use stereotyped nodes to make these things appear as
primitive building blocks.

• Similarly, if you are part of your project's release team, responsible for
assembling, testing, and then deploying releases, you might want to keep track of
the version number and test results for each major subsystem.

• Then use tagged values to add this information to your models.


Architecture
Any real world system is used by different users. The users can be developers,
testers, business people, analysts and many more. So before designing a system
the architecture is made with different perspectives in mind. The most important part
is to visualize the system from different viewer.s perspective. The better we
understand the better we make the system.

UML plays an important role in defining different perspectives of a system.

These perspectives are: Design View, Implementation View, Process View,


Deployment View, Usecase View
And the centre is the Use Case view which connects all these four. A Use case
represents the functionality of the system. So the other perspectives are connected
with use case.

Design of a system consists of classes, interfaces and collaboration. UML provides


class diagram, object diagram to support this.

Implementation defines the components assembled together to make a complete


physical system.

UML component diagram is used to support implementation perspective. Process


defines the flow of the system. So the same elements as used in Design are also
used to support this perspective.

Deployment represents the physical nodes of the system that forms the hardware.
UML deployment diagram is used to support this perspective.
The five views can be summarized as shown in the below table:
Software Development Life Cycle
The Unified Software Development Process
A software development process is the set of activities needed to transform a users
requirements into a software system.

Basic properties:
• use case driven
• architecture centric
• iterative and incremental
Use case Driven Use cases
• capture requirements of the user
• divide the development project into smaller subprojects,
• are constantly refined during the whole development process
• are used to verify the correctness of the implemented software
Architecture Centric:
• Find structures which are suitable to achive the function specified in the use
cases,
• understandable,
• maintainable,
• reusable for later extensions or newly discovered use cases and describe them, so
that they can be communicated between developers and users.
The overall software development life cycle can be visualized as shown below:

Inception establishes the business rationale for the project and decides on the scope
of the project.
Elaboration is the phase where you collect more detailed requirements, do high-level
analysis and design to establish a baseline architecture and create the plan for
construction.
Construction is an iterative and incremental process. Each iteration in this phase
builds production- quality software prototypes , tested and integrated as subset of the
requirements of the project.
Transition contains beta testing , performance tuning and user training
Critical activities in each phase

Inception:
Business case is established
20% of the critical use cases are identified

Elaboration:
Develop the architecture
Analyze the problem domain (80% of use cases are identified)

Construction:
Source code
User manual
Verification and validation of code

Transition:
Deployment of software
New releases
Training
CLASSES
Classes
A class is a description of a set of objects that share the same attributes, operations,
relationships, and semantics.

A class implements one or more interfaces. Graphically, a class is rendered as a


rectangle, usually including its name, attributes, and operations.

Name

• Every class must have a name that distinguishes it from other classes. A name is
a textual string.
• That name alone is known as a simple name;
• a path name is the class name prefixed by the name of the package in which that
class lives.
Attributes
• An attribute is a named property of a class that describes range of values that
instances of the property may hold.
• A class may have any number of attributes or no attributes at all. An attribute
• represents some property of the thing you are modeling that is shared by all
objects of that class.
• Graphically, attributes are listed in a compartment just below the class name.
• Attributes may be drawn showing only their names,

further specify an attribute by stating its class and possibly a default initial value
Operations
• An operation is the implementation of a service that can be requested from any
object of the class to affect behavior.
• An operation is an abstraction of something you can do to an object and that is
shared by all objects of that class.
• A class may have any number of operations or no operations at all.
• Operations may be drawn showing only their names.

Organizing attributes and relationships

• When drawing a class, you don't have to show every attribute


and every operation at once.
• Meaning that you can choose to show only some or none of
a class's attributes and operations
• Explicitly specify that there are more attributes or properties
than shown by ending each list with an ellipsis ("...").
• To better organize long lists of attributes and operations
you prefix each group with descriptive category by using
stereotypes
Responsibilities

A responsibility is a contract or an obligation of a class.


• When you create a class you are making a statement that all objects of that class
have the same kind of state and behavior.

• Ex: A Wall class is responsible for knowing about height, width, and thickness; a
FraudAgent class, as you might find in a credit card application, is responsible for
processing orders and determining if they are legitimate, suspect, or fraudulent; a
TemperatureSensor class is responsible for measuring temperature and raising an
alarm if the temperature reaches a certain point.

• Graphically, responsibilities can be drawn in a separate compartment at the


bottom of the class icon
DIAGRAMS

The UML's structural diagrams are roughly organized around the major
groups of things you'll find when modeling a system.

You might also like