Implementation: Programming Environments
Programming Environments
- The question of which is the “right” programming language has always been a favorite topic of discussion in programming circles.
- The choice of a programming language for the implementation of a project frequently plays an important role.
- In the ideal case, the design should be carried out without any knowledge of the later implementation language so that it can be implemented in any language.
Quality criteria for programming languages:
1. Modularity of a programming language
- Degree to which it support modularization of programs.
- The decomposition of a large program into multiple modules is a prerequisite for carrying out large software projects.
- Without modularization, division of labor in the implementation becomes impossible. Monolithic programs become unmanageable: they are difficult to maintain and document and they impede implementation with long compile times.
- Languages such as standard Pascal (which does not support modules, but compare with Turbo Pascal and Modula-2) prove unsuitable for large projects.
- If a language supports the decomposition of a program into smaller units, there must also be assurance that the components work together. If a procedure is invoked from another module, there must be a check of whether the procedure actually exists and whether it is used correctly (i.e. whether the number of parameters and their data types are correct).
- Languages may have independent compilation (e.g. C and FORTRAN), where this check takes place only upon invocation at run time (if at all)
- Alternatively, languages may have separate compilation (e.g. Ada and Modula-2), where each module has an interface description that provides the basis for checking its proper use already at compile time.
2. Documentation value of a programming language
- Affects the readability and thus the maintainability of programs.
- The importance of the documentation value rises for large programs and for software that the client continues to develop.
- High documentation value results, among other things, from explicit interface specifications with separate compilation (e.g. in Ada and Modula-2). Likewise the use of keywords instead of special characters (e.g. begin . . . end in Pascal rather than {. . .} in C) has a positive effect on readability because the greater redundancy gives less cause for careless errors in reading. Since programs are generally written only once but read repeatedly, the minimum additional effort in writing pays off no more so than in the maintenance phase. Likewise the language’s scoping rules influence the readability of programs.
- Extensive languages with numerous specialized functions (e.g. Ada) are difficult to grasp in all their details, thus encouraging misinterpretations. Languages of medium size and complexity (e.g. Pascal and Modula-2) harbor significantly less such danger.
3. Data structures in the programming language
- Primarily when complex data must be processed, the availability of data structures in the programming language plays an important role.
- Older languages such as FORTRAN, BASIC, and COBOL offer solely the possibility to combine multiple homogeneous elements in array or heterogeneous elements in structures.
- Recursive data structures are difficult to implement in these languages.
- Languages like C permit the declaration of pointers to data structures. This enables data structures of any complexity, and their scope and structure can change at run time. However, the drawback of these data structures is that they are open and permit unrestricted access (but compare with Java [Heller 1997]).
- Primarily in large projects with multiple project teams, abstract data takes on particular meaning. Although abstract data structures can be emulated in any modular language, due to better readability, preference should be given to a language with its own elements supporting this concept.
- Object-oriented languages offer the feature of extensible abstract data types that permit the realization of complex software systems with elegance and little effort. For a flexible and extensible solution, object-oriented languages provide a particularly good option.
4. Structuring control flow in the programming language
- Languages like BASIC and FORTRAN include variations of a GOTO statement, which programmers can employ to create unlimited and incomprehensible control flow structures. In Pascal and C the use of the GOTO statement is encumbered because the target must be declared explicitly. In Eiffel, Modula-2 and Smalltalk there is no GOTO statement at all, which forces better structuring of the control flow.
- In technical applications additional possibilities for control flow can play an important role. These include the handling of exceptions and interrupts as well as parallel processes and their synchronization mechanisms. Many programming languages (e.g., Ada and Eiffel) support several of these concepts and thus permit simpler program structures in certain cases.
Notes: Every deviation from sequential flow is difficult to understand and thus has a negative effect on readability.
5. Efficiency of a programming language
- The efficiency of a programming language is often overrated as a criterion. For example, the programming language C bears the reputation that it supports the writing of very efficient programs, while object-oriented languages are accused of inefficiency. However, there are few cases where a language is in principle particularly efficient or especially inefficient.
- Optimizing compilers often generate excellent code that an experienced Assembler programmer could hardly improve upon. For time-critical operations, it pays to use a faster machine or a better compiler rather than a “more efficient” programming language.
6. Integrity of a programming language
- The integrity of a programming language emanates primarily from its readability and its mechanisms for type checking (even across module boundaries).
- Independent of the application domain, therefore, a language with static typing should be preferred. Static typing means that for each expression the compiler can determine which type it will have at run time. Additional integrity risks include type conversions (type casts) and pointer arithmetic operations, which are routine for programming in C, for example.
- Run-time checks are also important for integrity, especially during the development phase. These normally belong in the domain of the compiler.
- Mechanisms for formulating assertions (e.g. in Eiffel) and features for exception handling (e.g. in Eiffel and Ada) also contribute to the integrity of a programming language.
7. Portability
- Portability can be a significant criterion if a software product is destined for various hardware platforms. In such a situation it makes sense to select a standardized language such as Ada or C. However, this alone does not suffice to ensure portability. For any external modules belonging to the language also need to be standardized. This is a problem in the language Modula-2 because various compiler producers offers different module libraries.
- Beyond standardization, another criterion is the availability of compilers for the language on different computers. For example, developers of software for mainframes will find a FORTRAN compiler on practically every machine.
8. Dialog support
- For interactive programs the programming language must also provide dialog support. For example, FORTRANT and COBOL offer only line-oriented input and output;
- Highly interactive programs (that react to every key pressed) can thus be developed only with the help of specialized libraries.
- Some languages like BASIC and Logo are particularly designed provide dialog support for the user (and with the programmer), making these languages better suited for such applications.
- Object-oriented programming languages also prove well suited to the development of interactive programs, especially with the availability of a corresponding class library or an application framework.
- For specialized tasks, specialized language elements can be decisive for the selection of a programming language. For technical applications, for example, the availability of complex number arithmetic (e.g. in COBOL) can be important. For mathematical problems, matrix operations (e.g. in APL) can simplify the task, and translation and character string operations are elegantly solved in Snobol. The lack of such specialized language elements can be compensated for with library modules in modular languages.
- Object-oriented languages prove particular suited to extending the language scope.
Additional characteristics of programming languages:
1. Quality of the compiler
The quality of the compiler is decisive for the actual implementation phase. A good compiler should not only generate efficient code, but also provide support for debugging (e.g. with clear error messages and run-time checks). Particularly in the area of microcomputers, many compilers have been integrated in development systems. Here the user-friendliness of such systems must also be considered.
2. Availability of libraries
With modular programming languages, the availability of libraries for various application domains represents a significant selection criterion. For example, for practically all FORTRAN compilers, libraries are available with numerous mathematical functions, and Smalltalk class libraries contain a multitude of general classes for constructing interactive programs. The availability of libraries can also be used in C or Modular-2 if the compiler supports linking routines from different languages. On the other hand, there are libraries that are available only in compiled form and usable only in connection with a certain compiler.
3. Availability of development tools
Today’s trend is toward the use of tools to support software development. Many tools intended for the implementation phase are bound to a particular programming language or even a certain compiler. Examples of such tools include structure-oriented editors, debugger and program generators. For example, if tools like Lex and YACC (tools for the application of attribute grammars on UNIX machines) are to be employed, then an implementation in C becomes unavoidable; choosing another language would only be justified of it promises gains greater than the cost of forfeiting the tool.
4. Company policy
Often a particular company policy influences the choice of a programming language. Frequently the language decision is made not by the implementors, but by managers that want to use only a single language company-wide for reasons of uniformity. Such a decision was made by the U.S. Department of Defense, which mandates the use of Ada for all programming in the military sector in the U.S (and thus also in most other NATO countries). Such global decisions have also been made in the area of telecommunications, where many programmers at distributed locations work over decades on the same product.
Even in-house situations, such as the education of the employees or a module library built up over years, can force the choice of a certain language. A company might resist switching to a more modem programming language to avoid training costs, the purchase of new tools, and the re-implementation of existing software.
5. External requirements
Sometimes external requirements force the use of a given programming language. Contracts for the European Union increasingly prescribe Ada, and the field of automation tends to require programs in FORTRAN or C. Such requirements arise when the client’s interests extend beyond the finished product in compiled form and the client plans to do maintenance work and further development in an in-house software department. Then the education level of the client’s programming team determines the implementation language.
Posted in Computer Science, Information Technology, Software Engineering, Software Engineering |
