From COBOL to OOP

3.5: Language Particularities

3.5 Language Particularities

Focus on the programming language of your choice

This section focuses on the programming languages of interest in our study. In particular, it describes special functionalities, such as procedure variables, overloaded methods, or nontypified parameters. All these functionalities are normally specific to a language: each language has its own particularities. Accordingly, we have divided this tutorial into two parts. The first discusses the particularities of Delphi, and the second those of Java. Readers who are interested only in one of these languages can skip the other.

3.5.1 Delphi Particularities

Open-Array Parameter

In Delphi, fixed sizes are assigned to arrays during the declaration. This is not necessarily an advantage, as we can easily see in the following example. For instance, if we have a given array[1..30] of Integer, a procedure for the output of this array would look as follows:

procedure Print (a: array[1..30] of Integer);   var i: Integer;begin   for i := 1 to 30 do WriteLn(a[i]);end;

Array without limits

This procedure has a fixed parameter list. For example, if a second array[1..32] of Integer were given and also had to be output, the procedures would have to be written a second time certainly a useless additional cost. The solution is an open-array parameter, which means that the array is declared without limits. When limits of the array are required within the procedure, they will always reach from 0 to High. Accordingly, the procedure could look as follows:

procedure...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programmable Logic Controllers (PLC)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.