Vous êtes sur la page 1sur 18

CS F213

Object Oriented Programming


Prof.R.Gururaj
BITS Pilani CS&IS Dept.
Hyderabad Campus
SW Complexity
The complexity of the SW systems we are asked
to develop is increasing, and on the other hand
we have limitations up on our ability to cope with
the complexity.

How do we resolve this????

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Consequence of Complexity
1. The more complex the system, the more open it is
for breakdown.
2. Our failure to manage complexity of the software
results in projects that are late, over budget,
deficiency in their state of requirements.
This condition is often called as software crisis.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Role of Decomposition
1. Dijkstras suggested a technique known as Divide and Rule.
2. Decompose a complex system into smaller parts, each of
which we may refine independently.
3. Now we will focus on only few things at a time.

Types of decomposition:
1. Algorithmic Decomposition
2. Object Oriented Decomposition

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Algorithmic Decomposition

1. The system is hierarchically organized as


modules.
2. Each module denotes a major step in some
overall process.
3. Process/functionality forms the basis for
modularization.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Object Oriented Decomposition

1. In this approach we view the worlds as set of


autonomous objects which collaborate to provide
some high level functionality.
2. Each object is simply a tangible entity in the world,
that exhibits some behavior.
3. We ask objects to do what they can do by sending
them messages.
4. This decomposition is based on objects not based
on the algorithm/process.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Algorithmic Vs. Object Oriented
Decomposition
Which is the right way of Decomposing a complex System?
Actually it is a tricky question.

Algorithmic Decomposition highlights the ordering of events.

OO Decomposition emphasizes the objects and their actions.


It is more about how objects collaborate to provide a
functionality.
We cant construct a system in both ways simultaneously.
We must decompose in either of the approach.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Algorithmic Vs. Object Oriented
Decomposition
OO Decomposition is best suited for more complex systems.

In OO approach, we can reuse the common mechanisms resulting in


increased reusability.

These OO systems are more resilient to change and thus better able
to evolve over time.

OO approach greatly reduces the risk of complex systems, since


these are evolved from already proven smaller systems in which we
already have confidence.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


The overall philosophy here is to define the software as
collection of objects (software components) of various types that
interact with each other through well-defined interfaces.

We can design an object to handle multiple functions and hence


can participate in several processes.
A software component can also store data.

Instead of implementing the entire process end-to-end and


defining the needed data structures along the way, we first
analyze the entire set of processes and from this identify
necessary software components.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Each component represents a data abstraction and is designed
to store information along with procedures to manipulate the
same.

The execution of the original process is broken in to several steps


and each of which is logically assigned to one of the software
components(objects).

The components can also communicate with each other as


needed to complete the process.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Library Management System

LibManagenet

UserMgmt BookTxMgmt BookInvMgmt

AddUser DelUser UserTxMgmt StaffTxMgmt BookMgmt RackMgmt

Borrow Retun Issue Rcev AddBook DelBook AddRack DelRack

Process/Algorithmic Decomposition

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


User Book
LoginID BookID
PW Title
Name Author
Placedin
Login()
ChangePW()

NormalUser StaffUser
StaffID
borrowLimit Designation
Start date Rack
Borrow() RackID
Issue()
Return() material
Receive()
AddBook()
Admin DoP
DelBook()
AddRack()
timeperiod
DelRack()

AddUser()
DelUser()
Object Oriented Decomposition GenerateReort()

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Object-oriented Software
Development
OOA, OOD, and OOP are related and are used in
developing object-oriented software.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


What is OOA

Object-oriented Analysis refers to a method of


analysis that examines the requirements from
the perspective of classes and objects found in
the vocabulary of problem domain.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


What is OOD

Object-oriented Design refers to any design


methodology that leads to object oriented
decomposition.

OOD encompasses the process of object


oriented decomposition and notation for
depicting logical (class, interfaces, collaboration
etc) , physical ( executables, tables, files etc) as
well as static and dynamic models of the system.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


What is OOP
Object-oriented programming is a method of
implementation in which programs are organized as
cooperative collections of objects , each of which
represents an instance of some class.
Characteristics of Object-oriented Programming:
1. Has Objects, not algorithms, as its basic building
blocks
2. Each object is an instance of some class
3. Classes are related to each other via
inheritance/dependency relationship

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Ch.1 of R1.
The Complete Reference- Java, 7th Edition, Herbert
Schildt, Tata McGraw Hill Publishing.

Ch.2 of R2. Object Oriented Analysis and Design with


Applications, Grady Booch, Addison Wesley, 2nd Edition.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus


Summary

Software complexity.

Role of decomposition.

Algorithmic and object-oriented decomposition.

Advantages of OO approach.

Prof.R.Gururaj Object Oriented Programming BITS Pilani, Hyderabad Campus

Vous aimerez peut-être aussi