This preview shows page 1. Sign up to view the full content.
Unformatted text preview: uted using the instance variables
of 'b' as data. Otherwise, the pointer to its super-class is followed. If it finds the
method in class 'A', it executes it on the data of 'b'. Otherwise, it searches A's
superclass if there is one. If 'A' has no super-class and the method has not been
found, an error is reported.
Procedure-oriented versus Object-oriented Programming
Conventional procedure-oriented programming languages use procedural
abstractions that encapsulate sequences of operations into procedures (also known
as functions, subroutines, or subprograms). On the other hand, object-oriented
programming languages encapsulate data as well as sequences of operations into
abstract entities called objects, providing a stronger encapsulation mechanism than
procedures. Hence object-oriented programming provides a more powerful
modeling tool than procedure-oriented programming.
Notice that both procedures and objects can be considered to be server modules
that may be called by clients to get certain actions performed. However, the basic
difference between the two is in their roles. The role of procedures is to transform
input data specified by parameters into values, while the role of objects is to serve
as a repository of data (the current system state) and to respond (perform the
requested action) in a manner determined by the current system state. For example, the response of a bank to a withdrawal request depends on the value of
the current balance.
The procedure-oriented programming paradigm has strong organizing principles
for managing actions and algorithms, but has weak organizing principles for
managing shared data. Object-oriented programming paradigm has strong
organizing principles both for managing actions and algorithms and for managing
shared data because it provides the capability to restrict applicable operations to
those associated with a specific object or class. Inheritance provides further
strength to this capability by allowing classes to be classified by factoring out
properties common to several sub-classes int...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14