3. Some important basic concepts of
the object-oriented programming
languages
The object-oriented programming (OOP) language is
usually called "4th generation language" (4GL) in
computer science, some various languages are available
in the market now, such as: Smalltalk, Turbo Pascal for
Windows, Borland C++, MS Visual C++, MS Visual
Basic,..., etc. Because OOP languages have developed
in the last ten years, it is rather new and it has not yet
reached a common standard recognized. Therefore,
some of them have more OOP mechanisms, some less.
Although the "Visual Basic" is not à complete OOP
language, it has touched some key concepts of the
OOP, and it is developing further in this direction and will
have more OOP mechanisms). It is said that the "Visual
Basic' is the best language compared with many other
languages which he has ever seen and used. The reason
is that it has made the full use of the windows' graphic
user interface (GUI).
The "Visual Basic" (VB) language is used and some
important basic concepts of it compared with the other
OOP languages are briefly introduced:
3.4 Object
Object includes data and procedure that are manipulated
by the object and are encapsulated in the object, that is,
the window or window body in the VB. In traditional
programming, sequence of the procedure and control
mechanism determine the control flow of the program.
This flow then provides the method for how to organize
the whole program in the programming creation period.
Therefore, it is quite unrealistic and cumbersome when
the dynamic world entities are involved in the programs.
The world is changing rapidly. Therefore, we should
adapt our thought and the data model to the changeful
world. To grasp the logical relationships between the
objects is the better choice. The OOP has precisely
grasped the relationships between the objects. To send
and receive the messages to and from the objects
determine the control flow of the programs of the OOP.
The object can understand the communication
relationships between each unit in the program through
the messages sent. The object responds the message
sent, and sends the message to the other object. it is the
message flow in the whoie system rather than the data.
it is not “to cali a function to act to some data”
(traditional viewpoint), but it is "to send a message to an
object” (OOP viewpoint) For example, many
programming mechanisms in the VB are to change the
properties of the object, to send the message to the
other object and to write programming codes for
responding. Although it sounds quite complex, you will
find that they simplify the programming efforts by using
the GUI very well.
3.2 Encapsulation
Encapsulation has two different viewpoints: one is from
the programming itself and one is from the programming
users.
(a) From the viewpoint of OOP itself
The use range of the data in the object is limited in the
OOP. in most circumstances a datum is designed to aim
at some special conditions or functions, and is not
intended to be used by any functions or statements. if
you do not limit the data used, when the program is
getting bigger, programmer may use the data elsewhere
in the program unintentionally because of carelessness.
in this way the data may be appeared elsewhere in the
program, and there may be no relation at all between
these data with the same name. The biggest bug of this
method will take place in the following situation: if the
program should be modified, added or deleted in some
day later, then the programmer will have very big
problem, because there is no way to find out where the
data will be in the program and You have to distinguish
them when you find them. You have to find them all over
the program continuously. That is why you should avoid
this bug in order to reduce the opportunities to introduce
such bugs. This is the main purpose of the
encapsulation.
( b) From the viewpoint of the users
The object includes the data and the procedure (or
method), the data are its property, and the procedure is
its behaviour. The encapsulation means to put the
property and the behaviour of the object together in the
object, this is à very popular term used in the OOP. To
encapsulate the property and the behaviour of the object
in the unique source code is more convenient and safe
than to put them eisewhere separately in the program.
3.3 Inheritance
A serious backward of the traditional programming
languages are unable to adapt the changes orf the world,
that is, you can not reuse the program designed when
changes take place. The only way is to modify even to
rewrite the whole program and leading to the resources
and programmer's efforts waste.
in OOP the advanced concepts, such as: object,
encapsulation, inheritance or reusability (in VB),... etc.
can be used to design the programs which can be
adapted to the changes of the world. The object can be
simply modified or extended for adapting to the new
situations. This is called the object inheritance or the
object reusability.
3.4 Dynamic application program with the automatic
responding event in real time
in the VB the “change” event can automatically respond
the change of the other control item. This means that the
program designed can follow the changes automatically.
Therefore, it is very useful for designing the dynamic
application programs that follow the changes
automatically.
374
International Archives of Photogrammetry and Remote Sensing. Vol. XXXI, Part B4. Vienna 1996
a)
Fi
rei