Programming Methodology
Programming Methodology is widely divided
into the two categories:
Ø Procedural Oriented Program (POP)
Ø Object Oriented Program (OOP)
v
Procedural
Oriented Program (POP)
Procedural
oriented programming language gives more emphasis to perform specific task
rather than data. It focuses on creating and ordering procedural or block of
code keeping on mind to accomplish/perform specific job.
For example: C, VB,
FORTRAN, etc...
v Limitation of Procedural Oriented Programming
Ø It focuses of process rather than data, data is given second class status.
Ø In pop there is no any data hiding concept.
Ø Access modifier like public private for protected which ensure data security is missing.
Ø Data and function are weakly coupled due to which data is shared among all function/Encapsulation.
v Advantage of object oriented programming
Ø In object
oriented program the main emphasis is given to data.
Ø Data and
member function are blinded together which limits the flow of data outside of
function. (Encapsulation)
Ø Providing
data hiding concept by abstraction.
Ø It provides
ways to secure the code by inheritance.
Ø It helps to
connect our program with real world which makes programming much easier.
Ø It helps to
achieve modular programming by making classes where each class is independent
to each other's.
Ø It use
Access modifier like public, Private and Protected which secure our data. Like
C++, JAVA, C#, VB.NET
v Differentiate Between Procedural Oriented Program
(POP) & Object Oriented Program (OOP)
v Concept Of Object
Oriented Programming
i.
Class and Object:
Class is the user defines data type
which allows the grouping of data and function. It is the blue print of object and
in real world scerleria data is attributes function are activities.
To
define the class we use the keyword class with class-name and by convention the
first letter of class-name is written on capital.
Syntax for
defining class:
class Class_name{
data;
function();
}
Object is runtime variable of class there
could be multiple object of single class to create the object variable is used
on object name with class_name.
Syntax for defining object
class_name object_name;
ii.
Encapsulation:
Encapsulation is the concept of object oriented
programming that bind together data and function that manipulate the data and
keep both safe from outside interface and misuse.
iii.
Abstraction:
Data abstraction in the
key feature of object oriented programming. It refers to provide only essential
information to the outside world and hiding their background details.
iv.
Inheritance:
Inheritance is the process in which one class acquires the
properties and behavior to modify and extend the attributes and behavior which
are define in other class.
The
class which inherits the member of other class is class is called derivative
class (child class)
and the class whose member is inherited is called base class (parent class).
Types of inheritance:
v Single
inheritance
In single Inheritance there is one
base class which properties are inherited by a derived class.
v Multi-level
inheritance
In
multi-level inheritance a class inherited properties from the derivative class
means will be the base class for next level derivative class.
v Hybrid
inheritance
Hybrid inheritance is the combination of multiple and
Hierarchical. In this there are many base class from which a single class
inherits the properties again from that single class multiple derived class are
formed.
v Multiple
inheritance
In
multiple inheritances there is a derived class of multiple base classes.
v Hierarchical
inheritance
In
hierarchical inheritance there is a multiple derived class of single class.
v.
Polymorphism :
Polymorphism means one things with many forms. It is one
of the most important concepts of OOP which means ability to process the object
differently depending upon the data type.
Typically polymorphism occurs when there
is hierarchy of class and classes are related with inheritance.