-->
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, May 18, 2017

Object oriented programming

Object Oriented Programming

The main objective of OOP is to reduce the difficulties which were faced in Procedural Oriented Programming style. OOP sees data as a sensitive element of the program and does not allow it to be accessed from all areas of the program. In this approach, data is closely tied to the functions associated with it and prevents data from unwanted modification by other functions. This approach breaks the program into small entities called Objects and creates data and functions inside these entities. 
"Object Oriented programming is an approach that provides the way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies on demand".


Key Features of Object Oriented Programming

Stress is on Data rather than procedure
Program is divided into small parts called Objects
Methods that operate on data are tied together inside class
Objects may interact with each other through methods.
New data and methods can be easily added
Software complexity can be easily managed
Follows bottom up approach
Through inheritance, we can eliminate the redundant code and can extend the use of existing classes


Applications of Object Oriented Programming


➤Real-time systems
➤Simulation and modeling
➤Databases
➤Artificical Intelligence and expert systems
➤Automation systems
➤Neural nets
➤Parallel Programming

Objects and Classes
Objects are runtime entities of an Object Oriented System. They represent a real-world object like a place, person, employee detail, bank account or any other item. Give problem is divided into terms of objects the type of communication among those objects is decided accordingly.Generally, an object is named such that it resembles real world object. Objects take space in memory just like "record" in Pascal, Structures in C and C++. It resides inside heap section of the memory.The "variables" that hold references to them can be on the stack or they can be contained in other objects which mean they can be on the heap also.
Objects contain data and methods that operate on it.This collection of data and methods is made used defined by wrapping it into a single unit called class.A class can be seen as customized data type and objects are the name which we give to its variable.Once we have declared a class, any number of objects can be created from it.For example, crow, sparrow, eagle are members of the class bird.Crow, sparrow, Eagle has all the property that a bird has.Similarly, an object has all the property that its class has.

Data abstraction and Encapsulation
The act of enclosing data and methods into a single unit is known as Encapsulation.Encapsulation is one of the prime features of Object Oriented Programming.In OOP model data is seen as a sensitive element and is not allowed to be accessed from outside world.Access is granted to only those methods which are tied with data inside the class.These methods provide an interface between object's data and the program.This is known as data hiding.

Hiding the internal implementation, background complicated details and highlighting the set of services is called abstraction.
For example:-
➤Mobile phones (The mobile persons are hiding the internal circuit implementation and highlighting touch screen). 
➤ATM Screens (Hiding the internal implementation and highlighting a set of services like withdraw, money transfer, mobile registration). 

Inheritance
The property by which a class acquires the property of another class in called Inheritance.It works on the concept of hierarchical classification.
The main purpose of the inheritance is code extensibility whenever we are extending automatically the code is reused. 
In inheritance one class giving the properties and behavior and another class is taking the properties and behavior. 
Inheritance is also known as is-a relationship means two classes belong to the same hierarchy.  
By using 'extends' keyword we are achieving inheritance concept.   
In the inheritance the person who is giving the properties is called parent the person who is acquiring the properties is called the child.  
To reduce the length of the code and redundancy of the code sun peoples introducing inheritance concept.

Polymorphism
Polymorphism is another very important feature of OOP.It refers to the ability to take more than one form.For example-A method may behave differently under different situations.The behavior depends on the number and types of data type used.For example, addition operation. If two integers are added then the sum will be generated whereas if two strings are added then the result will be a new concatenated string.
➤Ability to exhibit more than one form called polymorphism. 
Polymorphism is a Greek word 'poly 'means many and 'morphism' means forms.

 

No comments:

Post a Comment