Professional Documents
Culture Documents
om
organized.
The style of problem solving in object oriented technique is frequently the method used
to address problems in everyday life.
.c
So,computer novices are often able to take the basic ideas of OOP easily rather than
t
computer literate who are often blocked by their own preconceptions.
po
OOP treat data as a critical element in program and doesn’t allow it to flow freely
around the system.It ties data more closely to a function that operate on it.The data of
gs
an object can be accessed only by the function associated with that
object.However,function of one object can access function of another object.
lo
Object A 0bject B
.b
Function function
ew
od
Communication Communication
dc
Object C
m
Data
fucntion
om
I can be assured the flowers will be delievers.
.c
Mechanism to solve the problem(flower delievering) was to find an appropriate agent
t
and to pass her a message containing my request.It is the responsibility of florist to
po
satisfy my request.There is some method,some algorithm or set of operations used by
florist to do this.I donot need the particular method she will use to satisfy my request
sight). gs
also I donot want to know the details(i.e. the information is usually hidden form my
So,first principle of OOP solving is the vehicle by which activities are inititated.
lo
Action Is initiated in OOP by the transmission of a message to an agent(an
.b
object)responsible for the action.The message encodes the request for an action and is
supported by any additional information(arguments) needed to carry out request.The
eb
receiver is the agent to whom the message is sent.If the receiver accepts the message,it
accepts the responsibility to carry out the indicated action.In response to the
message,the receiver will perform some method to fulfill the request.
ew
florist is free to adopt any technique that achieves the desired result and is not
hampered by interference from my part.
So, discussing a problems in terms of responsibilities increases the level of abstraction.
dc
**Computation as simulation**
om
View of programming represented by the example of sending flowers to mom is very
different form the conventional convention of a computer.
The traditional model describing the behavior of a computer executing a program is a
process state or pigeon-hole model.
.c
In this pigeon-hole model, computer is a data manager, following some pattern of
t
instructions,wandering thorugh memory ,pulling values out of various memory
po
addresses,transforming them and pushing the results back into other slots.By examining
the values in the slots ,we can determine the state of machine or the results produced by
a computation.
gs
Disadvantages/limitaions of the pigeon-hole model is that it is difficult to understand how
to solve problems using the computer.
lo
In Object Oriented(OO) framework we never mention memory address,variables
.b
about problems in terms of behaviors and responsibility of objects they bring with them
a wealth of intuition ,ideas and understanding from their everyday experience.
od
om
Non-linear behavior of complexity
A task that would take one programmer two months to perform could not be
completed by two programmers working for one month.
.c
In Fred’s Brooks memorable phrase:”The bearing of child takes nine months
t
no matter how many women are assigned to the task”.
po
Reason for this non-linear complexity are:
1. The interconnections between software components were
complicated.
gs
2. Large quantities of information had to be communicated among the
various members of the programming team.
lo
3. An individual section of code can’t be understood by only a single
.b
person in the team.
eb
a)Procedure and function:Procedure and function are main two first abstraction mechanism
to be widely used in programming language.They allowed task that were executed repeatedly to
be collected in one place and reused rather than being duplicated several times.
dc
Libraries of procedures and function provided first hint of information hiding.They permit
programmer to think about operation in high level terms,emphasizing on what is being done,not
m
it is being implemented.
om
int mul(){
….
.c
……
}
t
po
}
Partially solved the abstraction mechanism
gs
c)Modules:It is basically a mechanism that allows the programmers to encapsulate a collection
lo
of procedures and data and supply both import and export statement to control visibility feature
from outside modules.
.b
One must provide the intended user with all the information needed to use the module
correctly and nothing more.
ew
One must provide the implementor with all the information needed to complete the
module and nothing more.
od
To solve instantiation,the problem of what to do,your application needed more than one
instance of software abstraction.The key to solve this problem is ADT.
ADT is simply programmer defined data type that can be manipulated in a manner similar
m
**Types of Classes**
There are different types of classes as mentioned below:
om
1. Data Managers:It is sometime called Data or State classes with the principal
responsibility of maintaining data or state information of one sort or another.For eg:in an
.c
abstraction of playing card,a major task for the class Card is simply to maintain the data
values that describe rank and suit.They are often recognizable as the nouns in the
t
po
problem description and are usually the fundamental building of a design.
2. Data sinks or data sources: These are the classes that generates data,such as random
number generator so that accept data and then process them further such as classs
gs
performing to a disk or file. Unlike a data manager, a data sink or data source does not
hold the data for any period of time, but generated it on demand or processes it when
lo
called upon.
3. View or observer classes: An essential portion of most application is the display of
.b
information on an output device such as terminal screen because the code for performing
eb
this activity is often complex, frequently modified and largely independent of the actual
data being displayed , it is good programming practice to isolate display behavior in class
other then those that maintain the data being displayed.
ew
4. Facilitator or Helper classes: These are the classes that maintain little or no state
information themselves but assist in the execution of complex task. For eg:- in displaying
a playing card image we use the services of a facilitator class that handles the drawing of
od
Definition of OOP
m
OOP is a programming paradigm based upon objects(having data + methods) that aims to
incorporate / provide the advantage of modularity and reusuability.
Definition of C++
C++ is an OOP language developed by Bjarne Stroustrup at AT&T Bell Laboratories in Murray Hill,
New Jersey , USA in early 1980’s.
Definitions of Object
It is defined as an instance of class that are used to interact with one another to design application
and computer programs. It has two components they are:
attributes (data)
om
behavior (functions).
.c
**Difference between Structured and Object Oriented Programming**
t
Structured/Procedure Oriented Object Oriented Programming
po
Programming
om
3. First focus on abstract of overall system or project and last it focuses on detailed design
or development.
4. First main function is executed and then the sub-function call which calls for code for sub
.c
function.
t
po
**Bottom-Up Approach**
systems. gs
1. Combining together various small modules / programs to give rise to more complex
**Features of OOP**
eb
om
Definition Of Class
.c
Class is defined as a user-defined data type that has its own data members and its associated
t
member functions that are accessed and used by creating class instances i.e. object.
po
gs
lo
.b
eb
ew
od
dc
m
The End