Information Technology Reference
In-Depth Information
(a)
f 1 (…)
f 2 (…)
method1 2
x 0
x 1
x 2
Obj 1
Obj 2
(b)
f 1 (…)
f 2 (…)
method2 2
x 0
x 1
x 2
Obj 1
Obj 2
Fig. 2.12 Schema of the concept of the object, formed as the communicating algorithms which
are to some extent autonomous, a the object Obj 1 receives the information about the state of the
object Obj 2 , necessary for the calculation of the transition function f 1 through calling an appropriate
method, the method 1 2 , b the result of calculation of the function f 1 causes changes of the state of
object Obj 2 realized through calling the method 2 2
As a result of calling (starting up) the method—the method in response to calling
gives back essential data (internal parameters) of the object Obj 2 (Fig. 2.12 a, solid
arrow).
After receiving the essential data, the function f 1 may calculate new values of
global internal parameters for the object Obj 1 , as well as internal parameters (all
or some) for the object Obj 2 .
The algorithm (object) Obj 1 may with the use of another method (the method 2 2 )
affect the state of internal parameters of the object Obj 2 and transfer the new values
calculated with the use of the function f 1 (Fig. 2.12 b).
Summing up, it may be ascertained that in order to solve the above-presented
problem mechanisms of communication referred to as methods , are applied, which
enable access to the parameters. Communication realized in this way is characteristic
of cooperating component algorithms referred to as objects.
This information exchange (communication) between the algorithms (objects)
with the use of methods is the underlying reason for the object concept and so-called
object-oriented approach.
2.5.2.2 The Application of an Observation Mechanism
for the Algorithm Behaviour
The solution using the process of communication is burdened with some imper-
fections, which results from the fact that the mechanism of communication does
not guarantee full independence (and at the same time autonomy) of cooperating
algorithms.
An algorithm which is asked by another algorithm to send (and similarly receive
transferred) data should agree to do that. It means that the algorithm Al g 1 while
calling a method, the method 2 of the algorithm Al g 2 must be provided with access
to the appropriately working method by the algorithm Al g 2 .
Search WWH ::




Custom Search