- Tech know how online

modular programming language (Modula-2)

The programming language Modula-2 (Modular Programming Language) combines - even more than its predecessor Pascal - simplicity and elegance with a wide range of applications. It was conceived in 1977 by Niklaus Wirth as an answer to the needs of coping with complex programming tasks. The key concept is"abstraction through modularization". Modula-2 is suitable for system programming as well as for the development of extensive software packages.

Modula-2 supports a good programming style and has - compared to e.g. the programming language Ada - a manageable vocabulary, which is based on a clear language concept.

The abstraction means of Modula-2

The most important abstraction means of the programming language Modula-2 is its module concept. It allows programs to be divided into manageable and largely independent parts - so-called modules - whose division into definition and implementation parts (definition module and implementation module) enables separate compilation. These modules can be stored in a program library. In their definition part is abstracted from the details of the realization of the module function. It describes what the module performs, not how. How the module function is fulfilled stands in the associated implementation part. For a distributed development it is sufficient therefore to specify as interfaces only the definition modules. The formulation of the implementation modules is then left completely to the developer responsible in each case. Also the testing of the modules can be made to a large extent independently. Modularization helps thus to get the difficulties, which bring along the design of extensive programs, under control.

The module concept of Modula-2

The module concept of Modula-2 permits furthermore the encapsulation of machine( compiler) dependent program parts in so-called base modules (low- level modules). This allows an individual language extension and at the same time facilitates the transfer of programs to different platforms. Consequently, Niklaus Wirth, the creator of Modula-2, did not include any element in the language whose implementation is better left to the user of the language. For example, there are no standard routines for input and output in Modula-2, no standard data type FILE, nor the concept of a task or a semaphore. Such programming elements are provided in general library modules.

All in all the module concept of Modula-2 fulfills the two most important criteria, which are to be placed to an adequate linguistic abstraction means: it is easy to understand and nevertheless helpful to master complex situations.

The second language concept, which is new compared to Pascal, is that of a coroutine. This can be used to express possible parallelisms in the processing of a task. Like modules, coroutines can be seen as an extension of the procedure concept. Coroutines find their application particularly with simulation tasks and in the system and real time programming, i.e. with a processing of asynchronous events. However, they can be used advantageously in other task areas, e.g. as an alternative to recursion.

Compared to Pascal, Modula-2 contains a number of additional extensions, but also some limitations.

Modula-2 is an elegant, easy to learn programming language and - especially because of the limitation of the language scope to the essentials - an efficient tool for the development of reliable software. It is easy to implement and in the main competes with the programming languages C, Ada and Pascal.

Englisch: modular programming language - Modula-2
Updated at: 03.11.2013
#Words: 546
Links: programming language (PL), Pascal (Pa), key (K), system, software (SW)
Translations: DE

All rights reserved DATACOM Buchverlag GmbH © 2022