Oosd Notes Unit-1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

OBJECT ORIENTED SYSTEM DESIGN

UNIT – 1

INTRODUCTION OF OBJECT ORINTED :


The word object-oriented is the combination of two words
i.e. object and oriented.

The dictionary meaning of the object is an article or entity that exists in the
real world.

The meaning of oriented is interested in a particular kind of thing or entity.


In layman's terms, it is a programming pattern that rounds around an
object or entity are called object-oriented programming.

It is used for software development . It works through the creation,


utilization, and manipulation of reusable objects to perform a specific task,
process or objective.

Element of Object Oriented System :

The structure, or building blocks, of object-oriented programming include


the following:

 Classes are user-defined data types that act as the blueprint for
individual objects, attributes and methods.
 Objects are instances of a class created with specifically defined
data. Objects can correspond to real-world objects or an abstract
entity. When class is defined initially, the description is the only
object that is defined.
 Methods are functions that are defined inside a class that
describe the behaviors of an object. Each method contained in
class definitions starts with a reference to an instance object.
Additionally, the subroutines contained in an object are called
instance methods. Programmers use methods for reusability or
keeping functionality encapsulated inside one object at a time.
 Attributes are defined in the class template and represent the state
of an object. Objects will have data stored in the attributes field.
Class attributes belong to the class itself.

Features Of Object Oriented Programming :

o Abstraction
o Encapsulation
o Inheritance
o Polymorphism

 Encapsulation :

Encapsulation is defined as the wrapping up variables and method into


a single unit.
It is the mechanism that binds together code and the data it
manipulates.
In Encapsulation, the variables or data of a class are hidden from any
other class and can be accessed only through any member function of
their class in which they are declared.
As in encapsulation, the data in a class is hidden from other classes, so
it is also known as data-hiding.
Consider a real-life example of encapsulation, in a company, there are
different sections like the accounts section, finance section, sales
section, etc. The finance section handles all the financial transactions
and keeps records of all the data related to finance. Similarly, the sales
section handles all the sales-related activities and keeps records of all
the sales. Now there may arise a situation when for some reason an
official from the finance section needs all the data about sales in a
particular month. In this case, he is not allowed to directly access the
data of the sales section. He will first have to contact some other officer
in the sales section and then request him to give the particular data.
This is what encapsulation is. Here the data of the sales section and the
employees that can manipulate them are wrapped under a single name
“sales section”.

 Information Hiding :
This concept is also often used to hide the internal representation
or state , of an object from the outside this is called information
hiding.
The of these details results is an abstraction which reduces the
external complexity and make the object or function easier to use.

 Abstraction :

Abstraction is one of the most essential and important features of


object-oriented programming.
Abstraction refers to providing only essential information about
the data to the outside world, hiding the background details or
implementation.
Consider a real-life example of a man driving a car. The man only
knows that pressing the accelerators will increase the speed of the
car or applying brakes will stop the car, but he does not know
about how on pressing the accelerator the speed is increasing, he
does not know about the inner mechanism of the car or the
implementation of the accelerator, brakes, etc in the car. This is
what abstraction is.

 Polymorphism :
The word polymorphism means having many forms.
In simple words, we can define polymorphism as the ability of a
message to be displayed in more than one form.
For example, A person at the same time can have different
characteristics. Like a man at the same time is a father, a husband, an
employee. So the same person posses different behavior in different
situations. This is called polymorphism.
There are two types of polymorphisms :
1.) Method Overloading :
Whenever class contain more than one method with same name
and different types of parameter called overloading.
2.) Method Overriding :
When we writing method name with same signature in parent
and child class called method overriding .
Without inheritance do not perform method overriding.
 Inheritance:

Inheritance allows us to define a class that inherits all the method,


behavior and properties from another class.
The class whose member are inherited is called Base class / parent
class.
The class which inherits the member of another class is called
derived class/ child class.

Types Of Inheritance :

1. Single inheritance
In single inheritance, one class inherits from only one parent class. This
is also called simple inheritance because it’s the simplest type of
inheritance you can use.
A class which contain one base class and only one derived class.

2. Multilevel Inheritance:
A class which contains only one base class and only multiple derived
class.
3. Multiple Inheritance:
A class which contains more than one base class and only one derived
class.

4. Hierarchical Inheritance:
A class which contains only one base class and multiple derived class
But each derived class can access base class.
5. Hybrid Inheritance :
H.I is a combination of more than one type of inheritance.

 Generosity :
It is a process that allows a function or a class to work with
different – different data types (That type of function is called
template function)
 Modeling :

Modeling is a proven and well accepted engineering techniques .


In building architecture we develop architectural models of
houses and high rises to help visualize the final product.
In UML a modal may be structural ,emphasizing the organization
of the system or it may be behavioral , emphasizing the dynamics
of the system . The model is a simplification of reality , providing
blueprint of a system.
Principles Of Modeling :

1. The choice of model is important


The choice of what models to create has a profound influence on how a problem
is attacked and how a solution is shaped. We need to choose your models well.

 The right models will highlight the most critical development problems.
 Wrong models will mislead you, causing you to focus on irrelevant issues.
For Example: We can use different types of diagrams for different phases in
software development.
2. Every model may be expressed at different levels of precision
For Example,

 If you are building a high rise, sometimes you need a 30,000-foot view for
instance, to help your investors visualize its look and feel.
 Other times, you need to get down to the level of the studs for instance,
when there's a tricky pipe run or an unusual structural element.
3. The best models are connected to reality
All models simplify reality and a good model reflects important key
characteristics.
4. No single model is sufficient
Every non-trivial system is best approached through a small set of nearly
independent models. Create models that can be built and studied separately, but
are still interrelated. In the case of a building:

 Importance of Modeling

 You can study electrical plans in isolation


 But you can also see their mapping to the floor plan and perhaps even
their interaction with the routing of pipes in the plumbing plan.
 Permits you to specify the structure or behavior of a system.
 Helps you visualize a system.
 Provides template that guides you in constructing a system.
 Helps to understand complex system part by part.
 Document the decisions that you have made.

 Unified Modeling Learning :

UML is a standard language for specifying, visualizing, constructing,


and documenting the artifacts of software systems.

UML was created by the Object Management Group (OMG) and UML
1.0 specification draft was proposed to the OMG in January 1997.

OMG is continuously making efforts to create a truly industry


standard.

 UML stands for Unified Modeling Language.


 UML is different from the other common programming
languages such as C++, Java, COBOL, etc.
 UML is a pictorial language used to make software blueprints.
 UML can be described as a general purpose visual modeling
language to visualize, specify, construct, and document
software system.
 Although UML is generally used to model software systems, it
is not limited within this boundary. It is also used to model
non-software systems as well. For example, the process flow in
a manufacturing unit, etc.

UML is not a programming language but tools can be used to


generate code in various languages using UML diagrams. UML has a
direct relation with object oriented analysis and design.
 A Conceptual Model of UML
A conceptual model can be defined as a model which is made of
concepts and their relationships.

A conceptual model is the first step before drawing a UML diagram.


It helps to understand the entities in the real world and how they
interact with each other.

As UML describes the real-time systems, it is very important to


make a conceptual model and then proceed gradually.

The conceptual model of UML can be mastered by learning the


following three major elements −

 UML building blocks


 Rules to connect the building blocks
 Common mechanisms of UML

 The building blocks of UML can be defined as −

 Things
 Relationships
 Diagram

 Things

Things are the most important building blocks of UML. Things


can be −

 Structural
 Behavioral
 Grouping
 Annotational

 Structural Things
Structural things define the static part of the model. They represent
the physical and conceptual elements. Following are the brief
descriptions of the structural things.

Class − Class represents a set of objects having similar


responsibilities.

Interface − Interface defines a set of operations, which specify the


responsibility of a class.

Collaboration −Collaboration defines an interaction between elements.

Use case −Use case represents a set of actions performed by a system


for a specific goal.

Component −Component describes the physical part of a system.

Node − A node can be defined as a physical element that exists at


run time.
 Behavioral Things

A behavioral thing consists of the dynamic parts of UML models.


Following are the behavioral things −

Interaction − Interaction is defined as a behavior that consists of a


group of messages exchanged among elements to accomplish a
specific task.

State machine − State machine is useful when the state of an object in


its life cycle is important. It defines the sequence of states an object
goes through in response to events. Events are external factors
responsible for state change

 Grouping Things

Grouping things can be defined as a mechanism to group elements of


a UML model together. There is only one grouping thing available −

Package − Package is the only one grouping thing available for


gathering structural and behavioral things.

 Annotational Things

Annotational things can be defined as a mechanism to capture


remarks, descriptions, and comments of UML model
elements. Note - It is the only one Annotational thing available. A
note is used to render comments, constraints, etc. of an UML
element.

 Relationship

Relationship is another most important building block of UML. It


shows how the elements are associated with each other and this
association describes the functionality of an application.

There are four kinds of relationships available.

1. Dependency

Dependency is a relationship between two things in which change in


one element also affects the other.

2.Association

Association is basically a set of links that connects the elements of a


UML model. It also describes how many objects are taking part in
that relationship.

3.Generalization

Generalization can be defined as a relationship which connects a


specialized element with a generalized element. It basically
describes the inheritance relationship in the world of objects.
4.Realization

Realization can be defined as a relationship in which two elements


are connected. One element describes some responsibility, which is
not implemented and the other one implements them. This
relationship exists in case of interfaces.

 Diagrams

UML diagrams are the ultimate output of the entire discussion. All
the elements, relationships are used to make a complete UML
diagram and the diagram represents a system.

The visual effect of the UML diagram is the most important part of
the entire process. All the other elements are used to make it
complete.

UML includes the following nine diagrams, the details of which are
described in the subsequent chapters.

 Class diagram
 Object diagram
 Use case diagram
 Sequence diagram
 Collaboration diagram
 Activity diagram
 Statechart diagram
 Deployment diagram
 Component diagram
Architecture Of UML :
Any real-world system is used by different users. The users can be
developers, testers, business people, analysts, and many more.

Hence, before designing a system, the architecture is made with


different perspectives in mind.

The most important part is to visualize the system from the


perspective of different viewers.

The better we understand the better we can build the system.

UML plays an important role in defining different perspectives of a


system. These perspectives are −

 Design
 Implementation
 Process
 Deployment

The center is the Use Case view which connects all these four. A Use
Case represents the functionality of the system. Hence, 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 the implementation perspective.

Process defines the flow of the system. Hence, 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.
 Object Modeling techniques :

The object modeling techniques is an methodology of object


oriented analysis, design and implementation that focuses on
creating a model of objects from the real world and then to use this
model to develop object–oriented software.

object modeling technique, OMT was developed by James


Rambaugh. Now-a-days, OMT is one of the most popular object
oriented development techniques.

It is primarily used by system and software developers to support


full life cycle development while targeting object oriented
implementations.

OMT has proven itself easy to understand, to draw and to use.

It is very successful in many application domains:


telecommunication, transportation, compilers etc.

Phase of OMT

The OMT methodology covers the full software development life


cycle. The methodology has the following phase.

1. Analysis –
Analysis is the first phase of OMT methodology. The aim of
analysis phase is to build a model of the real world situation to
show its important properties and domain.

This phase is concerned with preparation of precise and correct


modelling of the real world. The analysis phase starts with
defining a problem statement which includes a set of goals.

This problem statement is then expanded into three models; an


object model, a dynamic model and a functional model. The
object model shows the static data structure or skeleton of the
real world system and divides the whole application into objects.
In others words, this model represents the artifacts of the
system. The dynamic model represents the interaction between
artifacts above designed represented as events, states and
transitions.

The functional model represents the methods of the system from


the data flow perspective. The analysis phase generates object
model diagrams, state diagrams, event flow diagrams and data
flow diagrams.

2. System design - The system design phase comes after the


analysis phase. System design phase determines the overall
system architecture using subsystems, concurrent tasks and
data storage. During system design, the high level structure of
the system is designed. The decisions made during system
design are:
o The system is organized in to sub-systems which are then
allocated to processes and tasks, taking into account
concurrency and collaboration.
o Persistent data storage is established along with a
strategy to manage shared or global information.
o Boundary situations are checked to help guide trade off
priorities.

3. Object design - The object design phase comes after the


system design phase is over. Here the implementation plan is
developed. Object design is concerned with fully classifying the
existing and remaining classes, associations, attributes and
operations necessary for implementing a solution to the
problem. In object design:
o Operations and data structures are fully defined along
with any internal objects needed for implementation.
o Class level associations are determined.
o Issues of inheritance, aggregation, association and
default values are checked.
4. Implementation - Implementation phase of the OMT is a
matter of translating the design in to a programming language
constructs. It is important to have good software engineering
practice so that the design phase is smoothly translated in to
the implementation phase. Thus while selecting programming
language all constructs should be kept in mind for following
noteworthy points.
o To increase flexibility.
o To make amendments easily.
o For the design traceability.
o To increase efficiency.

You might also like