0% found this document useful (0 votes)
68 views6 pages

An Overview of Practical Impacts of Functional Programming

Functional Programming (FP) is a programming paradigm in which the mathematical function evaluation is the main block in building the software. FP languages are more suitable for handling parallelism and concurrency. Over the years, many different FP languages and programming style had been proposed and studied. However, FP is generally considered to be difficult to learn and master than another programming paradigms such as object-oriented programming. In this paper, we aim at deriving an understanding of practical impacts of using this paradigm in the software engineering practices through a literature review.

Uploaded by

J Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views6 pages

An Overview of Practical Impacts of Functional Programming

Functional Programming (FP) is a programming paradigm in which the mathematical function evaluation is the main block in building the software. FP languages are more suitable for handling parallelism and concurrency. Over the years, many different FP languages and programming style had been proposed and studied. However, FP is generally considered to be difficult to learn and master than another programming paradigms such as object-oriented programming. In this paper, we aim at deriving an understanding of practical impacts of using this paradigm in the software engineering practices through a literature review.

Uploaded by

J Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/323714122

An Overview of Practical Impacts of Functional Programming

Conference Paper · December 2017


DOI: 10.1109/APSECW.2017.27

CITATIONS READS
9 4,080

2 authors, including:

Ye Yang
University of Science and Technology of China
66 PUBLICATIONS   730 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Award vs. Worker Behaviors in Competitive Crowdsourcing Tasks View project

Who Should Take This Task?: Dynamic Decision Support for Crowd Workers View project

All content following this page was uploaded by Abdullah Khanfor on 01 April 2019.

The user has requested enhancement of the downloaded file.


An Overview of Practical Impacts of Functional
Programming

Abdullah Khanfor Ye Yang


School of Systems and Enterprises School of Systems and Enterprises
1 Castle Point Terrace 1 Castle Point Terrace
Stevens Institute of Technology Stevens Institute of Technology
Hoboken, New Jersey 07030 Hoboken, New Jersey 07030
Email: [email protected] Email: [email protected]

Abstract—Functional Programming (FP) is a programming programming in FP that it’s the essential aspects in improving
paradigm in which the mathematical function evaluation is the developers productivity in the early 1990’s. Unfortunately,
main block in building the software. FP languages are more general claims with each programming paradigm, including
suitable for handling parallelism and concurrency. Over the FP, that will improve the software development process [5].
years, many different FP languages and programming style had To develop further understanding on practical evidences of FP
been proposed and studied. However, FP is generally considered
to be difficult to learn and master than another programming
in software development life cycle, the main motivation of this
paradigms such as object-oriented programming. In this paper, study is to conduct in-depth research to identify the effects on
we aim at deriving an understanding of practical impacts of using software development life-cycle caused by adopting FP.
this paradigm in the software engineering practices through a
literature review.
II. L ITERATURE S EARCH AND S ELECTION C RITERIA
Keywords—Functional Programming, Software Engineering,
Literature Review. The early introduction of FP in the late 1960s propose
a challenge to collect all the possible research papers. Not
only that, the growing trend over the years for the usage of
I. I NTRODUCTION AND BACKGROUND
keyword “Functional Programming” in software engineering
The limitations on producing a faster clock rate Central and computer science research, is another layer to collect
Processing Unit (CPU), the growing number of interconnected papers. Especially, the influence of FP in software development
devices, and the demanding for more computing power raises life cycle (SLDC). Our paramount inclusion criterion is to
significant challenges for developing software that overcomes examine the papers that show any evidence of FP impact in
these constraints. Therefore, fundamental changes are required SDLC such as Design, Implementation, Testing, Maintenance,
for programming methodologies and paradigms to utilize the etc. Therefore, we exclude papers unrelated to our criterion;
existing computing power. Different programming paradigms e.g., papers concern in the programming language design.
have been proposed and applied in order to solve different Afterwards, published papers in one of the conferences and
problems such as Object-Oriented Programming (OOP), Func- journals related to FP or Software Engineering are collected
tional Programming (FP), Symbolic Programming, etc. The for the next phase of our research. The literature language,
simplicity of OOP eases the representation of many problems, of the gathered papers, is in English. Therefore, An exclusion
and the numerous OOP tool suites speed up the wide-spread for publications in other languages from our literature review
of OOP. Moreover, a large number of programmers familiar process. Lastly, all the accumulated papers are before August
with OOP paradigm is a cornerstone of its popularization in 2017.
building complex systems.
We perform the search in different online libraries. Consid-
Nowadays, with a physical limitation of faster CPU [1] ering the publishers related to computer science and software
that adopt Moore’s Law [2] is the primary motivation to engineering topics. The digital libraries that we conduct are:
employ parallelism and concurrency of distributed multi-core IEEE Xplore, ACM Digital Library, Elsevier ScienceDirect,
systems. Parallel computing is hard to achieve [3], but the more Springer Link Online, Wiley Online Library, Taylor & Francis,
demand with multi-core processors and distributed systems Oxford Journals and Google Scholar. We apply Functional
that require higher and well-structured computation processes. Programming as search term to all selected online libraries.
However, McKenney highlighted that parallel programming is This end up with 184 artifacts relevant to the topic. A first
considered to be hard topic [3], largely due to difficulty in FP round of screening process by reading the title and abstract
paradigm. The high cost of parallel systems and the relatively in which is performed to the collected research papers, talks,
rare demand made many developers not exposed to it. This books, reviews and articles. Papers with titles relevant to our
resulted in the lack of expertise in parallel programming within criterion had been examined carefully to extract informative
typical researchers and practitioners; the low accessibility to ideas and conclusions related to this paper. Figure 1 reflects
working parallel code; and the high overhead communication the collected paper for the study and shows the cumulative
between different parts. Hughes [4] demonstrated modular frequency over the years of publication.
180 encourage and enforce the developer to use the mathematical
160 functional style as the main block to bulid the software [20].
Number of Papers

140 No doubt that FP approach to develop applications is not a


120 question of the suitability of this paradigm to the industry.
100
80 We found one qualitative study by Pankratius et al. [6]
60 that reflects examine the effects of FP with practitioners. The
40 study covers the level of effort to write the code in FP differs
20 than other paradigm. As a matter of fact, it surveyed 13
0 developers using Scala and Java to represents FP and impera-
1980 1985 1990 1995 2000 2005 2010 2015 tive paradigms, respectively as a controlled comparative. This
Years type of studies are required to showcase the effect of such a
paradigm in the developer productivity, and the risks might
Fig. 1. Cumulative frequency of papers over the years of publication based
impose by using FP. Finally, it concludes practical insights for
on the literature search. FP in industry. In our case, we try to explore more related
studies that impact software development to answer RQ1 and
RQ2.
III. S TUDY D ESIGN
Before we start our study, an important term differentiate
In mind, the criterion for collecting papers; we designed between Pure and Impure FP languages. Pure functional lan-
the following research questions (RQs), to answer from the guages, such as Haskell, provide lazy evaluation and equational
collected literature: reasoning; Impure functional languages, such as SML, provide
features such as state, exception handling, or continuations
• RQ1: What are the research outlook in FP
[13]. The advantages of using pure or impure differ on the
paradigm?
application and requirements, but generally state and exception
By analyzing the literature and measuring the inter-
handling are important features for developers in industry.
action between the authors to draw an understanding
of what has been done and the research direction
expected. A. Functional Programming and Software Design
• RQ2: In which software engineering development Software design is a critical phase in software development
practice FP paradigm had been studied? life-cycle. Despite that, it is essential to consider the program-
To understand the practical impacts of using this ming paradigm that could be used during that phase. Although,
paradigm in the software engineering practice. Kiczales et al. [19] stated that OOP, Procedural Languages, and
FP have a fundamental abstraction and composition mecha-
To answer RQ1, Analysis of the research landscape by nisms rooted in some form of Generalized Procedure (GP)
studying the collected literature. The categorization based on languages. In which GP languages break down the system
different topics that effects SDLC such as Cost Estimation, into units of functions. Besides that, scholars mainly focuses
Defects, etc. Not only that, an additional categories to help us on the FP languages design and implementation and smaller
answer RQ2 such as Paradigms Comparative Studies, Educa- set of studies focus on the software processes aspects. First,
tion, etc. Table I shows each paper studied and it corresponding with purely FP on large scale software and with the lack of
category. expert developers in this paradigm could affect significantly
in software management, in general. In particular, Henderson
TABLE I. R ESEARCH PAPER COVERED AND THE CORRESPONDING
S OFTWARE E NGINEERING TOPIC . [18] stated that the complexity and the cost of software design
tasks using this paradigm plays a significant role in the lack of
Paradigms Comparative Studies [6]
Performance [6] [7]
adoption in the industry. Moreover, he proposed a particular
Developer Productivity [4] mixture of FP, formal specification, and rapid prototyping as
Testing [6] [8] [9] an effective methodology for software design.
Security [10] [11] [12]
Cost Estimation (Effort) [13] [14] [6]
Reusability [15] [13] [16] [4] [17] B. Functional Programming and Security
Design [18] [19]
Defects & Bugs [6] [8] [9]
Distributed [20] State changes during the execution of the code before re-
Parallel & Concurrency [20] [21] [22] turning the final value rises unintended side effects, especially,
Education [20] [23] in critical mission and real-time software’s [20]. In fact, some
studies claim that writing programs using functional languages
IV. F UNCTIONAL P ROGRAMMING IN S OFTWARE increases the security by enforcing the programmers to a
E NGINEERING P RACTICES particular method of writing the code that mitigates security
risks by forbidding the state changes in pure FP. Doligez et
FP programming used in software engineering practices al. [10] by using OCaml’s, a FP language semantics to fit
since 1960’s. As an example of early studies, McCarthy [24] the security requirements of XSVGen to investigate and build
and Landin [25] provide papers in this topic. FP is a style, in a secure XML validator by ensuring a software robustness
which, one could write functional programs in any language, and security in three levels, the source, compilation, and at
but of course with vastly differing levels of effort. Generally, the execution level. With such study that adopts from FP
we call the languages that encourage FP if its main goal to semantics an improving in the security of the proposed tools
and languages had been noticed. Another example of utilizing framework proposed for FP language by et al. Budimac [16] in
FP concepts to build an Attack Tree Domain Specific meta- 1996. Another influential framework Genome Analysis Toolkit
Language introduced by Damjanovic and Djuric [11]. By using (GATK), by McKenna et al [17], which uses FP concepts of
a Magic Potion [12], a purely functional Domain Specific MapReduce.
meta-Language that is grounded in FP and DLs is commonly
used to model different ways in which a system can be E. Functional Programming and Software Testing and Defects
attacked. We concluded from the different studies claims that
using the pure FP languages will ensure some security aspects Harrison et al. [15] that the time taken for testing an SML
by ensuring the no state changes in software execution. (FP) code comparing to C++ (OOP) is 105% more. Hence,
it needs more time to build test cases for FP comparing to
C. Functional Programming and Cost Estimation one written in C++. This may be caused by the familiarity
of the developers to write test cases that are suitable for
The imperative languages tend to be longer in lines of code OOP languages. Furthermore, there is a big increment of
comparing to FP languages. Thus, an effect in the software cost 118% in SML (FP) of the number of known errors per 1,000
and effort estimations. Moreover, Pure FP small changes may non-comment source lines comparing to C++ (OOP). As an
require an extensive restructuring of the program to meet these example of difficult bugs can be found, by only examining the
changes. Therefore, the productivity of software developer. By code, is a race condition. During the system testing, a vast
using the impure functional languages wisely, these changes amount of code will be tested that often hard to developers to
can reduce the effort in few lines of codes [20]. Coleman and diagnose the error resulting from the race conditions [8] [9].
Johnson [14] conduct an empirical study by investigating a In summary, testing in FP require more time and effort from
Scala projects from GitHub. The study concludes a contradic- the developers to write test cases.
tion in the belief of mathematical expressiveness of functional
languages will not affect the modular writing codes. However, F. Functional Programming for Parallel and Distributed Sys-
the authors suggested a future research in this direction for tems
better understanding the differences between FP and other
programming paradigms. Also, Coleman and Johnson [14] Building a programs for parallelism is consider to be
notice that hard decision counting, such as if statements, alone matter of a black art. it is a trial and error with experience
are deficient for solid estimating M because Scala high-order to make the program speedups in parallel environment; with
functions could make decisions that take Boolean returning less feedback from the runtime system [7]. FP immutable
function objects. It is also known “predicate contexts.”. data structure results in advantage for distributed systems.
The messages between different nodes in the system need
D. Functional Programming and Software Reuse to be consistent and the mutable data structure, in imperative
languages, can results in changing of the semantics and the end
FP languages, such as Ensemble and Erlang, provide a so- result of the execution [20]. To make FP suitable for parallel
phisticated module system. Higher-order functions encourage programming is the abstraction level provided by this paradigm
and promote the reuse and the most well-known example is with higher order functions and polymorphism [20]. Moreover,
map and fold functions [26]. For that, Functional developers pure functional programs which the main properties is no-
claim an increase in productivity comparing to conventional side effects. Therefore, an advantage for parallel evaluation
counterpart because of the short functional programs [4]. [21] [22]. As result, it is easier to identify parallel tasks
Harrison et al. [15] conducted a compression between OOP in program comparing to imperative programs [20]. In fact,
and FP by using C++ and Standard ML (SML) to represent Googles MapReduce [27] model is inspired by the map and
each paradigm. The results show that the number of the reduce functions used in FP. Thus, A parallel and distributed
function definitions in both paradigms had no significantly computing made accessible for developers in a field that was
different. However, 60% more functions were called in the exclusive for experts and specialized programmers [20]. As an
SML code than in the C++, and nearly four times as many example for providing a tool to understand and help in parallel
library functions. It concludes that metric for reuse the code is performance and finding bugs; Jones et. el [7] for a Parallel
one and a half time higher using SML comparing to C++ code. Haskell programs.
For that, using FP languages encourage the reuse practice in
programming than OOP languages. In addition, a conceptual G. Functional Programming and Education
limitation in conventional languages regarding modular the
problems. By encouraging the developer to recursive calls of Functional languages influence are increasing in industry
other functions we promote the reuse of codes and functions. and academia [28]. Functional paradigm importance introduc-
Moreover, a framework is a helpful approach to provide ing the strong connection between programming and math-
semi-finished classes in intend to help developers to build ematics [23]. In fact, the history of teaching a functional
solutions on top of it. Hence, it encourages the reusability to language go back to 1980s as one of the first books to
enhance codes and minimizes the effort needed to redo it. The taught for functional language scheme for beginners called
frameworks usage and proposal is a concrete topic of software “Structure and Interpretation of Computer Programs” [29]
engineering. However, designing reusable library components by MIT. The increasing attention to this paradigm is seen
consider to be a hard problem and requires expertise in the through European universities as a higher number of in-
language and dedication over a period to ensure a working stitutions teaching and researching this paradigm compar-
framework. No doubt, building a framework popularize the ing to US universities counterpart. In fact, a few num-
usage of language in industry and therefore, one of the first ber of Top US universities teaches FP according to a
survey (http://www.pl-enthusiast.net/2014/09/02/who- teaches- need for more qualitative studies, in general, to highlight the
functional-programming/) mentioned in Hu et al. [20] paper. benefits and drawback of adopting FP in software engineering
Additionally, As we research through the literature, we found processes. Finally, FP is well-established research topic and
a recommendation from Bailey’s to his book, Functional there are more papers had investigate the software engineering
Programming with Hope [23], as a good resource for education practice aspects that we didn’t include in our paper that worth
and beginners to understand this paradigm. to be examined the future work.

H. Functional Programming and Programming Languages R EFERENCES


Support.
[1] L. B. Kish, “End of moore’s law: thermal (noise) death of integration
We call a language functional if its design encourages or to in micro and nano electronics,” Physics Letters A, vol. 305, no. 3, pp.
144–149, 2002.
some extent enforces a functional style [20]. We collect the top
[2] I. Present, “Cramming more components onto integrated circuits,”
10 languages that support FP paradigm. The support, in our Readings in computer architecture, vol. 56, 2000.
study, means a higher-order function and lambda calculus that
[3] P. E. McKenney, “Is parallel programming hard, and, if so, what can
are features provided by the language design. In Table II shows you do about it?(v2017. 01.02 a),” arXiv preprint arXiv:1701.00854,
the top 10 languages based on TIOBE Index August 2017 [30] 2017.
programming languages ranking. We show the languages that [4] J. Hughes, “Why functional programming matters,” The computer
support that paradigm ranked and from the collected literature journal, vol. 32, no. 2, pp. 98–107, 1989.
that study each language. [5] T. Mens, “Introduction and roadmap: History and challenges of software
evolution,” in Software evolution. Springer, 2008, pp. 1–11.
TABLE II. F UNCTIONAL PROGRAMMING LANGUAGES POPULARITY [6] V. Pankratius, F. Schmidt, and G. Garretón, “Combining functional and
BASED ON TIOBE I NDEX R ANK AND THE FREQUENCY OF LANGUAGES IN imperative programming for multicore software: an empirical study
THE COLLECTED LITERATURE . evaluating scala and java,” in Proceedings of the 34th International
Programming Language Conference on Software Engineering. IEEE Press, 2012, pp. 123–133.
# TIOBE Index Rank Literature Rank [7] D. Jones Jr, S. Marlow, and S. Singh, “Parallel performance tuning
1 Python Haskell for haskell,” in Proceedings of the 2nd ACM SIGPLAN symposium on
2 PHP Java Haskell. ACM, 2009, pp. 81–92.
3 JavaScript Clojure
4 Swift Erlang, Lisp, and OCaml [8] M. Christakis and K. Sagonas, “Static detection of race conditions
5 R Merinda in erlang,” Practical Aspects of Declarative Languages, pp. 119–133,
6 Dart Scala and SML 2010.
7 D C++, F#, and Scheme [9] K. Claessen, M. Palka, N. Smallbone, J. Hughes, H. Svensson, T. Arts,
8 Scala Bootstrap
and U. Wiger, “Finding race conditions in erlang with quickcheck and
9 Prolog C#
10 Erlang Clean pulse,” ACM Sigplan Notices, vol. 44, no. 9, pp. 149–160, 2009.
[10] D. Doligez, C. Faure, T. Hardin, and M. Maarek, “Avoiding security
pitfalls with functional programming: a report on the development of a
As we see from Table II, Python is the most widely used secure xml validator,” in Software Engineering (ICSE), 2015 IEEE/ACM
programming language according to TIOBE index that support 37th IEEE International Conference on, vol. 2. IEEE, 2015, pp. 209–
FP paradgim. Where the literature we collected and examined, 218.
in our study, shows Haskell is the most language had been [11] V. Damjanovic and D. Djuric, “Functional programming way to interact
used and/or studied based. with software attacks and vulnerabilities,” in Software Testing, Verifi-
cation, and Validation Workshops (ICSTW), 2010 Third International
The answer for both RQ1 and RQ2 are overlapping. From Conference on. IEEE, 2010, pp. 388–393.
the previous sections, the answer for RQ1 that, we only high- [12] D. Djuric and V. Devedzic, “Magic potion: Incorporating new devel-
lighted a small set of research papers in FP for each category opment paradigms through metaprogramming,” IEEE software, vol. 27,
no. 5, pp. 38–44, 2010.
we propose. But from the initial effort, notice a great amount
[13] P. Wadler, “The essence of functional programming,” in Proceedings
of well-established research in different software engineering of the 19th ACM SIGPLAN-SIGACT symposium on Principles of
aspects in FP. Despite that, the answer for RQ2, we found a programming languages. ACM, 1992, pp. 1–14.
lack of qualitative and survey-based research that conduct a [14] R. Coleman and M. A. Johnson, “Power-laws and structure in functional
field studies and getting a feedback from developers to inspect programs,” in Computational Science and Computational Intelligence
the effects of FP in the software engineering practices. We (CSCI), 2014 International Conference on, vol. 2. IEEE, 2014, pp.
are confident such studies could give a insightful knowledge 168–172.
for researchers and practitioners to ensure some concepts and [15] R. Harrison, L. Samaraweera, M. R. Dobie, and P. H. Lewis, “Com-
claims around FP. paring programming paradigms: an evaluation of functional and object-
oriented programs,” Software Engineering Journal, vol. 11, no. 4, pp.
247–254, 1996.
V. C ONCLUSION & F UTURE W ORK [16] Z. Budimac, M. Ivanovic, and S. Zivkov, “On the design of a functional
programming framework,” in Systems, Man, and Cybernetics, 1996.,
FPs are getting increasing interests and applications by IEEE International Conference on, vol. 2. IEEE, 1996, pp. 1548–
the practitioners. The growth of programming languages and 1552.
the research trends emphasize the value of the paradigm. We [17] A. McKenna, M. Hanna, E. Banks, A. Sivachenko, K. Cibulskis,
examined 184 scientific papers to understand the landscape of A. Kernytsky, K. Garimella, D. Altshuler, S. Gabriel, M. Daly et al.,
the field. Moreover, a considerable amount of papers identified “The genome analysis toolkit: a mapreduce framework for analyzing
next-generation dna sequencing data,” Genome research, vol. 20, no. 9,
the effects of functional programming in software life-cycle. pp. 1297–1303, 2010.
Believing that more studies need to be conducted from the [18] P. Henderson, “Functional programming, formal specification, and rapid
software engineering research community to propose the suf- prototyping,” IEEE Transactions on Software Engineering, no. 2, pp.
ficient tools and frameworks in order to help the developers. A 241–250, 1986.
[19] G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. Lopes, [25] P. J. Landin, “The mechanical evaluation of expressions,” The Computer
J.-M. Loingtier, and J. Irwin, “Aspect-oriented programming,” Journal, vol. 6, no. 4, pp. 308–320, 1964.
ECOOP’97Object-oriented programming, pp. 220–242, 1997. [26] P. Wadler, “How to solve the reuse problem? functional programming,”
[20] Z. Hu, J. Hughes, and M. Wang, “How functional programming in Software Reuse, 1998. Proceedings. Fifth International Conference
mattered,” National Science Review, vol. 2, no. 3, pp. 349–370, 2015. on. IEEE, 1998, pp. 371–372.
[21] M. M. Chakravarty, R. Leshchinskiy, S. Peyton Jones, G. Keller, and [27] J. Dean and S. Ghemawat, “Mapreduce: simplified data processing on
S. Marlow, “Data parallel haskell: a status report,” in Proceedings of large clusters,” Communications of the ACM, vol. 51, no. 1, pp. 107–
the 2007 workshop on Declarative aspects of multicore programming. 113, 2008.
ACM, 2007, pp. 10–18. [28] M. Boespflug, “Conversion by evaluation,” in International Symposium
[22] K. Hammond, “Why parallel functional programming matters: Panel on Practical Aspects of Declarative Languages. Springer, 2010, pp.
statement.” in Ada-Europe, vol. 6652. Springer, 2011, pp. 201–205. 58–72.
[23] R. Bailey, Functional programming with Hope. Ellis Horwood, 1991. [29] H. Abelson, G. J. Sussman, and J. Sussman, Structure and interpretation
[24] J. McCarthy, “Recursive functions of symbolic expressions and their of computer programs. Justin Kelly, 1996.
computation by machine, part i,” Communications of the ACM, vol. 3, [30] T. software BV. (2017) Tiobe index for august 2017. Accessed:
no. 4, pp. 184–195, 1960. 2017-08-28. [Online]. Available: https://www.tiobe.com/tiobe-index

View publication stats

You might also like