Overview of OOP - Viva Clipper !
Overview of OOP - Viva Clipper !
Viva Clipper !
Overview of OOP
“After years of relative obscurity, object orientation appears to be entering the mainstream of
commercial computing for both software developers and end users. A shift to object orientation
is occurring simultaneously across a wide range of software components, including languages,
user interfaces, databases, and operating systems. While object-oriented programming is no
panacea, it has already demonstrated that it can help manage the growing complexity and
increasing costs of software development”.
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 1/7
17/10/21 22:09 Overview of OOP | Viva Clipper !
Nexpert Object and Level 5 Object from Information Builders; and graphical user
interfaces (GUIs) such as Microsoft Windows, as well as UNIX GUIs such as Open
Software Foundation’s Motif, and Sun Microsystems’ Open Look.
Although object orientation applies in slightly different ways in each of the areas
mentioned above, the same basic concepts are being applied in each case. Because of its
broad scope, the term is often misused, especially in marketing claims; indeed, articles
have been written on this subject, such as “My Cat is Object-Oriented”, by Roger King
of the University of Colorado.
This abuse often arises from the fact that object orientation in user interfaces is not easy
to define clearly, and it is through user interfaces that end users encounter object
orientation, usually without realizing it. Some vendors assert that their products are
object-oriented merely because they use screen windows – the windows are objects, the
argument goes, and therefore the program is object-oriented.
One of the main driving forces for the adoption of OOP is likely to be the need to
produce programs that run under graphical user interfaces such as Microsoft
Windows. This means that changing from procedural to object-oriented programming
may involve changing not just the language being used, but the operating
environment, resulting in an extremely steep learning curve.
While GUIs promise to make life easier for the end user, they will only make it harder
for the programmer, unless we are prepared to change our programming style. Writing
programs with a completely object-oriented architecture simplifies development for
GUIs, since the program architecture reflects the architecture of the underlying
environment.
forced to learn a new programming style as well as the complexities of event driven
programming in a GUI.
We’ll start our climb of the learning curve with a brief look at the history of object-
oriented languages, followed by an introduction to object-oriented concepts.
The concept of an object class and inheritance, central to object-oriented languages, was
first implemented in the language Simula 67, an extension of Algol 60 designed in 1967
by Ole-Johan Dahl and Kristen Nygaard from the University of Oslo and the
Norwegian Computing Center (Norsk Regnesentral). Although Simula, as it is now
called, is a general purpose programming language, it is not in wide usage.
The Smalltalk language itself was the first ‘true’ object-oriented language in that it
dealt exclusively with objects. All subsequent object-oriented languages have been
based on the concepts used in Smalltalk. Smalltalk was important, not just for its
language, but for the development tools available in the Smalltalk environment. These
include class browsers and object inspectors. A class browser is a very powerful tool
which allows program code to be edited in a much more convenient and structured
way than with conventional editors. Because of the inherently well-defined structure of
object-oriented programs, the class browser is capable of displaying a given program’s
class hierarchy in graphical form, allowing the user to ‘point and shoot’ to select a
particular method (procedure) to be edited. Many programming tasks become menu
driven, such as the creation of new classes, modifying the structure of the inheritance
tree, and modifying the structure of a class. These operations are more complex and
tedious when performed in a traditional editing environment.
Tools such as these are an integral part of the promise of object-oriented technology.
They can simplify a programmer’s life, reducing development time and costs.
Although they are a rarity in the DOS world at present, as the move toward object-
oriented technology grows, and as we move towards GUIs like Microsoft Windows,
these tools will become more commonplace.
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 3/7
17/10/21 22:09 Overview of OOP | Viva Clipper !
What is an Object?
One of the fundamental reasons that object orientation is enjoying such success as a
programming paradigm is very simple: the real world is made up of objects. An
invoice is an object. A stock item is an object. A balance sheet is an object. An entire
company is an object. Objects can contain other objects (this is called composition); and
in this way complete systems can be constructed using objects.
But what is an object from a programming point of view? Simply put, it is a collection
of related data, which is associated with the procedures which can operate on that
data.
By this definition, most well-structured programs could be said to contain objects. This
is another contributing factor to the confusion surrounding the definition of object
orientation.
Before we can clarify our definition of an object further, we need to explore a few other
concepts.
In any given system, many objects will exist. Many of these objects will be very similar
to each other: for example, you might have thousands of invoice objects stored on disk.
Although each one is different, they all share a common set of attributes. The same
operations are valid on all of them. There is a term to describe such a collection of
similar objects: it is called a class.
A class can be thought of as a template, or specification, for creating an object. The class
itself consists of details specifying what the structure of its objects should be. The class
can also be said to ‘contain’ the program procedures which are permitted to operate on
objects of that class.
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 4/7
17/10/21 22:09 Overview of OOP | Viva Clipper !
For example, an Invoice class would contain procedures for printing and updating
invoices. It would also contain details of the structure of an invoice object, for example
that each invoice object must contain variables named date, customer, amount, etc.
Earlier, an object was defined as a module containing both procedures and data. An
object’s procedures are known as methods. This terminology helps to distinguish them
from procedures which are not associated with an object, since there are fundamental
differences. In a fully object-oriented system such as Smalltalk, there are no
procedures, only methods. In a hybrid system such as C++, or Clipper with Class(y),
both methods and procedures can coexist.
Methods are not called in the same way that procedures are. Rather, messages are sent
to objects, which respond by executing the appropriate method. All valid operations on
or using the data in an object are defined by its methods, so all operations on an object
are accomplished by sending messages to the object. Because of this, it is not necessary
for other objects to access, or even know about, the internals of foreign objects. Objects
behave like black boxes: send them a message, and they respond by executing the
appropriate method. Send the print message to an invoice object, and it will respond
by printing itself. This black box approach is known generally as encapsulation, and
while it is possible to achieve in procedural systems, object-oriented systems actively
encourage, support and enforce it.
Common properties among groups of classes can often be combined to form a parent
class, or superclass. For example, it might make sense for a Quotation class, an Order
class, and an Invoice class to all share the same superclass, a Sales Document class. The
Quotation, Order, and Invoice classes are thus subclasses of the Sales Document class.
This is known as inheritance. The subclasses inherit all the properties of their
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 5/7
17/10/21 22:09 Overview of OOP | Viva Clipper !
superclass, and may add unique, individual properties of their own. This concept can
be extended further, with subclasses of subclasses. Such class hierarchies are a
common feature of object-oriented systems.
Polymorphism
The term polymorphism in this context refers to the fact that the same message, such as
print, can result in different behaviors when sent to different objects. Sending the print
message to a graph object has a different effect than it would on a balance sheet object.
With a traditional procedural approach, the programmer is forced to differentiate
procedure names, using names like PrnBalSheet and PrintGraph. In an object-oriented
language, this differentiation is unnecessary, and in fact unwise.
Polymorphism has benefits for the programmer in that the same name can be used for
conceptually similar operations in different classes, but its implications go deeper than
that. It means that a message can be sent to an object whose class is not known. In a
procedural system, given a variable of unknown type, a CASE statement would
typically be required to test the type of the variable and pass it to the correct procedure
for the desired operation. In an object-oriented system, a message is sent to the object
with no testing, and the object responds accordingly.
This has important implications for inheritance, since it means that methods belonging
to classes near the root of the inheritance tree do not need to know details of the
subclasses which may be inherited from them. By sending messages with standardized
names to the objects with which it deals, generic methods can be written which can
later be used with any class which supports the required messages.
This article borrowed from manual of famous Clipper 3tdh party Library : CLASS(Y)
http://www.the-oasis.net/ftpmaster.php3?content=ftplib.htm
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 6/7
17/10/21 22:09 Overview of OOP | Viva Clipper !
This entry was posted in Articles and tagged black boxe, CASE, Class(y), Classes,
DATA, Encapsulation, inheritance, Instance Variables, Instances, Messages, Methods,
object, Object-Orientation, Object-Oriented Languages, PARC, Polymorphism,
PROCEDURE, Smalltalk, Subclasses, Superclasses. Bookmark the permalink.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Blog at WordPress.com.
https://vivaclipper.wordpress.com/2013/06/14/overview-of-object-orientation/ 7/7