Conference PaperPDF Available

Object Oriented Programming (Tutorial).

Authors:

Abstract

A classical procedural program (written in COBOL, FORTRAN, BASIC, PASCAL, LISP or APL2) is made of sentences that execute sequentially in a predefined order, that depends only on the values of the data the program is working with. This order can usually be deduced by visual inspection of the program. A non-procedural program (written in PROLOG, for instance) contains a certain number of instructions that will not be executed in a predefined order. They receive control from an inference processor , a procedural program that decides in every moment the order in which the sentences of the program should receive control (should be fired). In both the procedural and the non-procedural cases, the basic unit of execution is the program . The data only provide values that will be used to perform computations or to decide the order of execution. A given application is a hierarchical set of programs (modules) each of which is capable of invoking other programs in the hierarchy. The data may be global (accessible from every program in the hierarchy) or local (accessible by the program where they belong and, sometimes, by those at a lower level in the hierarchy). In Object-Oriented Programming (OOP in short), things are different. Here it is the data that are organized in a basic control hierarchy. One piece of data may be linked to another through a relation of descendancy, and this fact gives rise to a network (usually a tree) similar to the hierarchy of programs in procedural programming. There are also programs in OOP, but they are appendages to the data (in the same way as in classical programming data are appendages of programs). It is possible to build global programs (accessible to all the data in the hierarchy) and local programs (accessible from certain objects and their descendants). In OOP, the execution of a program is fired by means of a message that somebody (the user, another program or an object) sends to a given object. The recipient of the message decides which program should be executed (it may be a local program, or a global program which must be located through the network that defines the structure of the objects). There is a certain amount of confusion on what is Object-Oriented Programming and what is not. This has happened before, with other fields in Computer Science. There are still people, for instance, that call Artificial Intelligence to any program that is written in Prolog or Lisp. In the same way, there are those who maintain that any program written in Smalltalk, C++ or Objective C is OOP. As in the AI example, this is not always the case. Another source of confusion comes from the fact that Object-Oriented Programming has been frequently used to build complicated user interfaces, with window systems, icons and so forth, and this has produced the unexpected results that many people believe that any program including these interfaces is OOP. Again, this is obviously wrong. The basic elements of OOP are Objects, Methods and Messages. An Object is a complex data element that possesses structure and is a part of an organization. It embodies three different concepts: A set of relations to other objects (usually represented by pointers). A set of properties (which have values). A set of methods (defined by means of executable code). A method is a procedural program written in any language. What other programming systems call functions, programs or procedures, Object-Oriented Programming calls methods. There is no essential difference between programs in any language and methods, except for the fact that in pure OOP the CALL instruction is not allowed. The reason for this is obvious: the CALL instruction is
OBJECT-ORIENTED PROGRAMMING
TUTORIAL
By Manuel Alfonseca
IBM Madrid Scientific Center
Paseo de la Castellana, 4
28046 Madrid (SPAIN)
ABSTRACT
A classical procedural program (written in COBOL,
FORTRAN, BASIC, PASCAL, LISP or APLZ) is made
of sentences that execute sequentially in a predefined order,
that depends only on the values of the data the program is
working with. This order can usually be deduced by visual
inspection of the program.
A non-procedural program (written in PROLOG, for
instance) contains a certain number of instructions that will
not be executed in a predefined order. They receive control
from an inference
processor,
a procedural program that
decides in every moment the order in which the sentences
of the program should receive control (should be fired).
In both the procedural and the non-procedural cases, the
basic unit of execution is
the program.
The data only
provide values that will be used to perform computations
or to decide the order of execution. A given application is
a hierarchical set of programs (modules) each of which is
capable of invoking other programs in the hierarchy. The
data may be global (accessible from every program in the
hierarchy) or local (accessible .by the program where they
belong and, sometimes, by those at a lower level in the
hierarchy).
In Object-Oriented Programming (OOP in short), things
are different. Here it is the dura that are organized in a
basic control hierarchy. One piece of data may be linked
to another through a relation of descendancy, and this fact
gives rise to a network (usually a tree) similar to the
hierarchy of programs in procedural programming. There
are also programs in OOP, but they are appendages to the
data (in the same way as in classical programming data
are appendages of programs). It is possible to build global
programs (accessible to all the data in the hierarchy) and
local programs (accessible from certain objects and their
descendants).
Permission to copy without fee all or part of this material is granted provided that
the copies an not made or dlstributsd for direct commercial advantage, the ACM
copyright notice and the title of the publication and its date appear, and notice
is given that copying Is by permission of the Association for Computing
Machinery. To copy otherwise, or to republish, requires a fee and/or specific
permission.
. 1990 ACM 08S7S1.371.x/90/0008/0007...61.50
In OOP, the execution of a program is fired by means of a
messuge that somebody (the user, another program or an
object) sends to a given object. The recipient of the
message decides which program should be executed (it
may be a local program, or a global program which must
be located through the network that defines the structure of
the objects).
There is a certain amount of confusion on what is Object-
Oriented Programming and what is not. This has
happened before, with other fields in Computer Science.
There are still people, for instance, that call Artificial
Intelligence to any program that is written in Prolog or
Lisp. In the same way, there are those who maintain that
any program written in Smalltalk, C+ + or Objective C is
OOP. As in the AI example, this is not always the case.
Another source of confusion comes from the fact that
Object-Oriented Programming has been frequently used to
build complicated user interfaces, with window systems,
icons and so forth, and this has produced the unexpected
result that many people believe that any program including
these interfaces is OOP. Again, this is obviously wrong.
The basic elements of OOP are Objects, Methods and
Messages.
An Object is a complex data element that possesses
structure and is a part of an organization. It embodies
three different concepts:
l
A set of relations to other objects (usually represented
by pointers).
l
A set of properties (which have values).
l
A set of methods (delined by means of executabIe
code).
A method is a procedural program written in any
language. What other programming systems call functions,
programs or procedures, Object-Oriented Programming
calls methods. There is no essential difference between
programs in any language and methods, except for the fact
that in pure OOP the CALL instruction is not allowed.
The reason for this is obvious: the CALL instruction is
APL QUOTE QUAD 7 Manuel Alfonseca
used in classical programming to build the hierarchy of
programs, that OOP replaces by a hierarchy in the data.
Therefore, OOP can be defined as
programming without
CALL,
in the same way that Structured Programming was
defined as
programming without GOTO.
A message is a request to activate a method sent by an
object to another object. The requested method can belong
to the receiving object, or it may be inherited from one of
its ancestors in the hierarchy.
The fundamental properties of object oriented
programming can be summarized thus:
l
Encapsulation: all the information related to a given
object (including properties, methods and relations) is
directly accessible from this object and form a part of
its structure. The object can be transplanted to another
data organization as a self-defined unit.
l
Inheritance: objects may inherit properties and
methods from other objects. in this way, it is not
necessary to define many times a given property if it is
shared by a certain number of objects. Inheritance
may be simple (if the object has a single parent) or
multiple (if there are several parents for a given
object).
l
Polxmorphism: programs (methods) and properties
may be made local to certain objects and their
descendants. Thus, the same names can be used at
different objects to perform related, but different
procedures.
The main benefits of OOP can be summarized as follows:
l
Yodeling
Power:
OOP data structures and hierarchies
are more similar to conceptual models than the
hierarchical code structures of classical programming.
Therefore, the conversion from the mental model to
the programmed application is more natural and
simple.
l
llodularity: Objects are natural modules.
Encapsulation isolates their data and programs from
other objects. lnformatiori hiding makes it possible to
Object Oriented Programming, Tutorial APL90
work in a truly modular way. A large application can
be separated into pieces, each of which can be
independently programmed by different people with
very few interface considerations.
Extensibility: The hierarchical structure of OOP data,
together with hiding and inheritance, make it very easy
to add new instances,
new
classes, new properties or
new behavior to a given application. Incremental
programming is
thus a
typical property of OOP
applications.
Elimination of redundancy:
Properties and methods
common to many objects can be defined at a common
ancestor and inherited from that ancestor. Therefore, a
given property or method need be defined only once.
Reusability:
Classes in an OOP system (common
ancestors to many objects) can be transported and
reused in many applications with practically no
change.
OOP languages
can
be classified in two groups: pure OOP
languages (where the CALL instruction is strictly
forbidden), such
as
SMALLTALK and Hypertalk, and
hybrid OOP languages, that allow it in certain cases, such
as C+ + , Objective C, Object Pascal, Eiffel and APL2
(see references 1 to 5). fiis tutorial will describe in detail
how to do OOP in APLZ.
1 .O References
1.
2.
3.
4.
5.
Cox, B. Object-Oriented Programming: an
Evolutionary Approach.
Addison Wesley, 1986.
Meyer,
B. Object-Oriented Software Construction.
Prentice Hall, 1988.
Peterson, G. (editor)
Object-Oriented Computing.
Vol.
1 & 2. IEEE order no. 821, 822. 1987.
Smalltalk- V User’s
Guide. Digitalk Inc.
Alfonseca, M.
Frames, Semantic Networks and Object-
Oriented Programming in APL2
IBM J. Res. Dev.,
33:5, p. 502-510, Sep. 1989.
... And yet we have some slight evidence from subsequent use that this change is at least better than our first redesign. The bestpractices advocated in object-oriented design lead programmers to create powerful abstractions to maximize modularity, extensibility and reusability while minimizing redundancy (Alfonseca, 1990). These principals do not seem to enable end users to appropriate and reconfigure in the way that programmers are meant to search through and select from abstract classes and superclasses in Smalltalk. ...
Article
In this position paper, we discuss the role of abstraction in designing for appropriation. We examine the ways in which varying the level of abstraction of tools affects the ability of users to appropriate them. We close with some words about the difficulties of evaluating the appropriability of systems and how they might be addressed in an experimental framework. published or submitted for publication is peer reviewed
Article
The paper explores the design and implementation of ARDA, an Expert System to analyse Reliability Data. Initially the viability of the knowledge domain is explored. The philosophy of design of the system is discussed. Details of the implementation are described. There is discussion of extension of system to other statistical analyses and of using alternative inferential bases.
Article
Full-text available
The paper describes a general and extensive graphic system in two or three dimensions, built in APL2 by means of the object-oriented programming paradigm. The system fully demonstrates the appropriateness of the language to develop real-life applications using the most advanced techniques of computer science.
Conference Paper
Object oriented programming has become an important and accepted part of the computer software industry. Nearly every new operating system that has recently arrived or is scheduled to arrive soon is object oriented in nature. If APL2 is to continue to be a mainstream computational environment, it is very important that it becomes object oriented.Finding a way that APL2 may sit comfortably in these new operating systems is important. Unfortunately, in both implementation and current programming teaching philosophy, existing APL2 does not easily offer the end user the ability to adopt this new approach. This paper proposes some small changes to the basic APL2 language definition which will permit objects to be defined and used. It also suggests some major changes to the end user's programming methodology.
Conference Paper
The paper explores the design and implementation of ARDA, an Expert System to analyse Reliability Data. Initially the viability of the knowledge domain is explored. The philosophy of design of the system is discussed. Details of the implementation are described. There is discussion of extension of system to other statistical analyses and of using alternative inferential bases.
Conference Paper
Full-text available
The paper describes a general and extensive graphic system in two or three dimensions, built in APL2 by means of the object-oriented programming paradigm. The system fully demonstrates the appropriateness of the language to develop real-life applications using the most advanced techniques of computer science.
Article
Full-text available
This paper discusses the capabilities of APL2 for the implementation of frame systems and semantic networks, and for the use of object-oriented programming techniques. The fact that the frame is a basic data structure of APL2 makes this language very appropriate for the development of artificial intelligence applications using the indicated techniques. Examples are given of the way in which they may be applied to realistic situations.
Article
This brief guide gives an overview of using Pocket Smalltalk to write applications for Palm platform handheld computers. To use this guide effectively you should be familiar with the Smalltalk programming language, but a brief introduction to Smalltalk is included for beginners.
Article
Object-Oriented Software Construction, second edition is the comprehensive reference on all aspects of object technology, from design principles to O-O techniques, Design by Contract, O-O analysis, concurrency, persistence, abstract data types and many more. Written by a pioneer in the field, contains an in-depth analysis of both methodological and technical issues.
Article
Object oriented programming departs from conventional programming by emphasizing the relationship between consumers and suppliers of codes rather then the relationship between a programmer and his code. The author describes the development of an object-oriented C language compiler, and how it can be put to work
User's Guide. Digitalk Inc. Smalltalk- V User's Guide
  • V Smalltalk