KEMBAR78
Chapter 1 | PDF | Object Oriented Programming | Class (Computer Programming)
0% found this document useful (0 votes)
5 views7 pages

Chapter 1

The document discusses the Object-Oriented Paradigm (OOP), highlighting its advantages over structured programming, such as modularity, reusability, and ease of maintenance. It outlines key features of OOP including encapsulation, inheritance, and polymorphism, and compares OOP with other programming paradigms. Additionally, it addresses the importance of software maintenance and the concept of software crises, emphasizing OOP as a solution to these challenges.

Uploaded by

Pandu Ranga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Chapter 1

The document discusses the Object-Oriented Paradigm (OOP), highlighting its advantages over structured programming, such as modularity, reusability, and ease of maintenance. It outlines key features of OOP including encapsulation, inheritance, and polymorphism, and compares OOP with other programming paradigms. Additionally, it addresses the importance of software maintenance and the concept of software crises, emphasizing OOP as a solution to these challenges.

Uploaded by

Pandu Ranga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

Object-Oriented
Paradigm
Structured programming views the two core elements of
any program—data and functions as two separate
entities, whereas OOP views them as a single entity.
Software developed using Object-Oriented techniques are
proclaimed as more reliable, easier to maintain, easier to
reuse and enhance, and so on. The Object-Oriented
Paradigm is effective in solving many outstanding
problems in software engineering.

Software maintenance is the process of modifying or


extending the capabilities of the existing software. It
requires mastery in understanding and modifying the
existing software, and finally revalidating the modified
software.

The term “software crises” refers to the overrun of the


cost of software development in terms of both budget
and time-target. The state-of-the-art solution to overcome
software crisis is the Object-Oriented Paradigm.

The power of Object-Oriented languages is that the


programmer can create modular, reusable code and as a
result, formulate a program by composition and
modification of the existing modules.
Flexibility is gained by being able to change or replace
modules without disturbing other parts of the code.
Software development speed is gained, on one hand, by
reusing and enhancing the existing code and, on the
other hand, by having programming objects that are
close in representation to the real-world objects, thus
reducing the translation burden (from a real-world
representation to the computer-world representation) for
the programmer.

The fundamental features of OOPs are the following:


 Encapsulation
 Data abstraction
 Inheritance
 Polymorphism
 Message passing
 Extensibility
 Persistence
 Delegation
 Genericity
 Multiple inheritance
C++ supports all the above except Persistence.

Encapsulation is a mechanism that associates the code


and the data it manipulates into a single unit and keeps
them safe from external interference and misuse.

Polymorphism in C++ is achieved by function


overloading, operator overloading, and dynamic binding
(virtual functions).

The phenomenon where the object (data) outlives the


program execution time and exists between executions of
a program is known as persistence. All database systems
support persistence. In C++, this is not supported.
However, the user can build it explicitly using file streams
in a program.

Delegation.

Genericity.

There is no single programming style that is best suited


for all kinds of applications. For example, procedure-
oriented programming would be best suited for the
design of computation-intensive problems; rule-oriented
programming would be best suited for the design of a
knowledge base; and logic-oriented programming would
be best suited for a hypothesis derivation. The Object-
Oriented style is best suited for a wide range of
applications; indeed, this programming paradigm often
serves as the architectural framework in which other
paradigms are employed. Each one of these styles of
programming require a different mindset and a different
way of thinking about the problem, based on their own
conceptual framework.

Monolithic Programming consists of only global data and


sequential code. Program flow control is achieved
through the use of jumps and the program code is
duplicated each time it is to be used, since there is no
support of the subroutine concept and hence, it is
suitable for developing small and simple applications.
Examples: Assembly language and BASIC

Procedural Programming.
Examples: FORTRAN and COBOL
Structured programming has evolved as a mechanism to
address the growing issues of programming-in-the-large.
Larger programming projects consist of large
development teams, developing different parts of the
same project independently. The usage of separately
compiled modules (algorithmic decomposition) was the
answer for managing large development teams.
Programs consist of multiple modules and in turn, each
module has a set of functions of related types.
Examples: Pascal and C

Object-based language = Encapsulation + Object identity

Ada is one of the typical object-based programming


languages.

Object-oriented language = Object-based features +


Inheritance + Polymorphism
Examples: C++, Smalltalk, Eiffel, Java, etc.

Unlike the traditional methodology (Function-Oriented


Programming—FOP), Object-Oriented Programming
emphasizes on the data rather than the algorithm.

The methods defined in an object’s class are the same for


all objects belonging to that class but, the data is unique
for each object.

A language’s quality (and its elements) is judged by


twelve important criteria. They are a well defined
syntactic and semantic structure, reliability, fast
translation, efficient object code, orthogonality (language
should have only a few basic features, each of which is
separately understandable), machine independence,
provability, generality, consistency with commonly used
notations, subsets, uniformity, and extensibility. The
various constructs of OOP languages (such as C++) are
designed to achieve these with ease.

Hiding the implementation details within an object results


in the user being more concerned with an object’s
relationship to the rest of the system, than the
implementation of the object’s behavior. This distinction
is a fundamental departure from earlier imperative
languages (such as Pascal and C), in which functions and
function calls are the centre of activity.

Grady Booch, a renowned contributor to the development


of Object-Oriented technology, defines OOPs as follows:
OOP is a method of implementation in which programs
are organized as co-operative collections of objects, each
of which represents an instance of some class and whose
classes are all members of a hierarchy of classes united
through the property called inheritance.

OOP uses objects and not algorithms as its fundamental


building blocks.

A program without inheritance is definitely not an Object-


Oriented one; it resembles the program with abstract
data types.

Some objects may correspond to real-world entities such


as students, employees, bank accounts, inventory items,
etc., whereas, others may correspond to computer
hardware and software components. Hardware
components include a keyboard, port, video display,
mouse, etc., and software components include stacks,
queues, trees, etc.
Every object will have data structures called attributes
and behavior called operations.

Objects are the basic run-time entities in an Object-


Oriented system.

Class is an implementation of abstract data type.

MULTIPLE VIEWS OF THE SAME OBJECT.

Encapsulation is a mechanism that associates the code


and the data it manipulates and keeps them safe from
external interference and misuse. Creating new data
types using encapsulated items that are well suited to an
application to be programmed is known as data
abstraction. The data types created by the data-
abstraction process are known as Abstract Data Types
(ADTs).

Class enables encapsulation and creation of abstract data


types.

When a software system can be constructed largely out


of reusable components, development time can be
concentrated for understanding that portion of the
system which is new and unusual.

The two most common techniques for reusing


functionality in Object-Oriented systems are class
inheritance and object composition.
In inheritance, if the class D is derived from the class B, it
is said that is a kind of B.

The new approach to object composition takes a view


that an object can be a collection of many other objects,
and the relationship is called a has-a (D has-a B)
relationship or containership.
Delegation is a way of making object composition as
powerful as inheritance for reuse. In delegation, two
objects are involved in handling a request: a receiving
object delegates operations to its delegate. This is
analogous to subclasses sending requests to parent
classes.

Binding refers to the tie-up of a procedure call to the


address code to be executed in response to the call.
Dynamic binding (also called late binding) means that the
code associated with a given procedure call is not known
until its call at runtime.

In OO programming, the attention is focused on objects.


In this, data do not flow around a system; it is the
messages that move around the system.

C++ provides three kinds of memory allocation for


objects: static (preallocated by the compiler in fixed
global memory); automatic (allocated on the stack) and
dynamic (allocated from a heap).

C++ do not have a garbage collector.

C++ does not support the concept of dynamic binding in


a thorough sense and hence, it is (sometimes) considered
a poor OOP language.

You might also like