О функциональном программировании и модульности

Автор: Скопин Игорь Николаевич

Журнал: Проблемы информатики @problem-info

Рубрика: Теоретическая и системная информатика

Статья в выпуске: 3 (44), 2019 года.

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

В связи С грядущим переходом к использованию экзафлопСных вычислителей, актуальна разработка методов программирования для нетрадиционных моделей вычислений, допускающих выполнение на очень большом числе процессоров. В этом плане весьма перспективной представляется функциональная модель, возможности которой но отношению к модуляризации программ, обсуждаются в сопоставлении С модульностью в императивных языках. Показана несостоятельность претензии на универсальность как функционального, так и императивного стилей каждый из них имеет свою область адекватного применения.

Модуляризация, императивное программирование, функциональное программирование, модель вычислений, абстрактный вычислитель, мсмоизация, стиль программирования

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

IDR: 143172474   |   УДК: 004

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.

Список литературы О функциональном программировании и модульности

  • Asanovic К. ет AL. The landscape of parallel computing research: a view from Berkeley. Technical Report No. UCB/EECS-2006-183. Berkeley: University of California, EECS Department, December 18, 2006. URL: www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-183.pdf(дата обращения: 24.05.2019).
  • Backus J. Can Programming be Liberated from von Neumann style? A Functional Style and its Algebra of Programs. Comm. ACM, 21, 1978.
  • McCarthy 91 function Wikipedia. URL: https://en.wikipedia.org/wiki/McCarthy_91_ function#Knuth.27s_generalization (дата обращения: 24.05.2019).
  • Городняя Л. В. Основы функционального программирования. Курс лекций. М.: Интернет-университет информационных технологий, 2004. 5-9556-0008-6. ISBN: 5-9556-0008-6
  • Hughes J. Why Functional Programming Matters. Computer Journal, 32 (2), 1989. Русский перевод: Дехтяренко И. А. Сильные стороны функционального программирования. URL: http: //www.softcraft.ru/paradigm/fp/whyfp.shtml(дата обращения: 24.05.2019).
  • Непейвода Н.Н., Скопин И.Н. Основания программирования. Москва-Ижевск: РХД, 2003 г.
  • Дал У.-И., Дейкстра Э., Хоор К. Структурное программирование // Пер с англ. М.: Мир, 1975.
  • Лисков Б., Гатэг Дж. Использование абстракций и спецификаций при разработке программ. М.: Мир, 1989.
  • Stroustrup В. What is Object-Oriented Programming? IEEE Software. 1988. V. 5 (3).
  • Косивченко. А. Зачем же нужна виртуализация? URL: https://habrahabr.ru/post/91503/ (дата обращения: 24.05.2019).
  • Sylvan S. Why does Haskell matter? URL: http://www.dtek.chalmers.se/~sylvan/ haskell/why_does_haskell_matter.html (дата обращения: 24.05.2019).
  • Ершов А.П. О сущности трансляции. Препринт Л*8 6, Новосибирск: ВЦ СО АН СССР, 1977.
  • Winstanley N. What the hell are Monads? 1999, URL: http://www.abercrombiegroup.co. uk/~noel/research/monads.html (дата обращения: 24.05.2019).
  • Keene S. E. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS. Addison-Weslev (Reading, Massachusetts, 1989). И. Н. Скотт
  • Skopin I.N. An Approach to the Construction of Robust Systems of Interacting Processes // In: Parallel PROGRAMMING: Practical Aspects, Models and Current Limitations. NOVA science publishers. Scries: Mathematics Research Developments. Editor: M. S. Tarkov. 2014, 978-163321-957-1.
  • ISBN: 9781633219571
  • Цейтин Г. С. На пути к сборочному программированию. Программирование. 1990. № 1, С. 78-99.
Еще