Comparison of opportunity modularization in functional and imperative programming styles

Бесплатный доступ

The article “Comparison of opportunity modularization in functional and imperative programming styles” discusses the issues of expressiveness of the language means proposed for the two programming styles. The solution to these issues is relevant in connection with the preparation for the transition in the near future to the efficient use of ultra-high power computing equipment: the programmer has the opportunity to build calculations using a very large number of processors and cores. Today, interest in functional computing has grown very much, and a dangerous trend, very typical for the development of computer science, has appeared: one can consider an unconventional functional style as a panacea for all programming problems in the imperative style update. In this regard, one of the main goals of the article being proposed is to dispel the myth of the universality of the functional style and find for it, as well as for the imperative style, an adequate place among the methodological approaches to solving programming problems. This goal is specified as a comparison of means of supporting imperative and functional modularization. The basis of this comparison is the assertion that the gain in the transition from the traditional style to the new is not in what you have to give up, but in a new quality, which the new style gives in comparison with the old one (see D. Hughes article “Why Functional Programming Matters”). With regard to the transition from an imperative to a functional model of computing, this means an answer to the question of language programming tools that provide new qualities of modularity. First of all, these arc tools that allow one to implement lazy calculations and handling functions of high orders, as well as a mechanism for eliminating re-counting, called memoization. The approach to achieving the goals is based on the use of formally defined operations of an abstract computer in the execution of individual constructions of an imperative and functional program. This allows somebody to consider language constructs as templates for connecting parts of a program. As a result, it is possible to uniformly describe the development and use of modules for both the imperative and functional model of computing. One of the main consequences of this approach is the ability to accurately specify the boundaries of the adequate applicability of imperative and functional modularization, as well as the conditions for the correct joint combined use of the means of these two styles. The proposed method is in good agreement with the concept of mixed computing, in that aspect, which back in 1977 A.P. Ershov quite accurately called the essence of translation. The exposition of imperative and functional modularization completes the list of losses that a programmer should not forget about when switching from using a traditional model of calculations to a functional one: Memory passivity cannot be expressed in a functional style. The notion of states of a computational process, which in many eases give its natural decomposition, is lost in a functional language. The concept of the context of calculations in a functional language becomes significantly narrower than when working in an imperative style: for and it is important that the contexts arc organized hierarchically. Managing the ordering of computations over time is contrary to functionality.

Еще

Modularization, imperative programming, functional programming, computing model, abstract calculator, memoization, style of programming

Короткий адрес: https://sciup.org/143172474

IDR: 143172474

Статья научная