8 Mar 2013

POP and OOPS


Procedure  oriented programming  (POP)
Object oriented programming (OOP)
POP emphasis on algorithms (procedure)
OOP emphasis on data rather
 than procedure.
Large programs are divided into smaller programs known as functions.
Programs are divided into objects.
They have not facility to hide data.
They have facility to hide data from
outside world.
Function can transfer data from one function to another and one form to another form.
Objects can communication with
each other using functions.
It does not have powerful features like operator overloading, inheritance etc.
It contains powerful features
 like operator overloading, inheritance.
For design program it uses top-down approach.
For design program it uses bottom-up
approach.
Examples: C, COBOL, FORTRAN etc.
Examples: C++, java




Application of OOP
o      Following are the applications for object oriented language.
o      Real time systems
o      Simulation and modeling
o      Object oriented database
o      Hypertext, hypermedia and expertext
o      AI and expert systems
o      Neural network and parallel programming
o      Decision support system
o      Office automation system
o      CIM / CAM / CAD systems


Benefits of OOP
o      Following are the benefits of object oriented programming language.
o      User can create new data type or users define data type by making class.
o      Code can be reuse by using inheritance.
o      Data can be hiding from outside world by using encapsulation.
o      Operators or functions can be overloaded by using polymorphism, so same functions or operators can be used for multitasking.
o      Object oriented system can be easily upgrade from small system to large system.
o      It is easy to partition work for same project.
o      Message passing techniques make communication easier.
o      Software complexcity can be easily managed.
o      Maintenances cost is less.
o      Simple to implement.

Message Passing:
o      Objects can communicate with each others by passing message same as people passing message with each other.
o      Objects can send or receive message or information.
o      Message passing involves name of object, name of function (message) and information to be send.
o      For example, student.mark(name). Here student is object, mark is message, name is information.


  Dynamic binding:
o      Binding means link between procedure call and code to be execute.
o      Dynamic binding means link exist between procedure call and code to be execute at run time when that procedure is call.
o      It is also known late binding.
o      It is generally use with polymorphism and inheritance.
o      For example, complier comes to know at runtime that which function of sum will be call either with two arguments or with three arguments.

  Polymorphism:
o      Polymorphism is a Greek term which means ability to take more than one form.
o      For example, + is used to make sum of two numbers as well as it is used to combine two strings.
o      This is known as operator overloading because same operator may behave differently on different instances.
o      Same way functions can be overloaded. For example, sum () function may takes two arguments or three arguments etc. i.e. sum (5, 7) or sum (4, 6, 8).


   Inheritance OR Derivation:
o      The mechanism of deriving a new class from an old class is called inheritance or derivation. The old class is known as base class while new class is known as derived class or sub class.
o      The inheritance is the most powerful features of OOP.




Data Abstraction:
o      Abstraction refers representation of necessary features without including more details or explanations.
o      Classes use the concept of abstraction.
o      Classes define list of abstract attributes like height, weight etc.
o      These attributes are sometimes called data members because they hold information. The functions that operate on these data are sometimes called methods or member functions.
o      Since classes use the concept of data abstraction, they are known as Abstract Data Types (ADT).


Encapsulation:
o      Combine data and functions into a single unit (called class) known as encapsulation.
o      Encapsulation is most important features of class. By which we can combine data and functions in one unit.
o      Using encapsulation we can hide data from outside world.
o      To hide data from direct access by program is known as data hiding or information hiding.

Classes:
o      Classes are user defined data types and it behaves like built in types of programming language.


o      Object contains code and data which can be made user define type using class.


o      Objects are variables of class.


o      Once a class has been defined we can create any number of objects for that class. A class is collections of objects of similar type.


o      We can create object of class using following syntax,


Syntax:   class-name object-name;


o      Here class name is class which is already created. Object name is any user define name. For example, if student is class,


Example: student s1, s2;


o      In example s1 and s2 are name of objects for class student. We can create any number of objects for class.


OBJECT: 
o     Objects are basic runtime entity in object oriented system. 
o      Objects may be a pen, a person, a table etc.
o      Objects may define user define data types like time, vectors etc.
o      Programming problems analyzed in terms of objects.
o      Object should be chosen such that they match closely with real world objects.
o      Objects required memory space for storage just like structure of ‘C’ language.
o      One object can send message to another objects.
o      For example student and record are two objects and student object may send request to record object for marks, then record object send marks for particular student.
o      Object can interact with each other without having knowledge about data and code of each other’s.



No comments:

Post a Comment











































































































Support From Kuldeep Sheoran