Computing Reviews

Crossing the gap from imperative to functional programming through refactoring
Gyori A., Franklin L., Dig D., Lahoda J.  ESEC/FSE 2013 (Proceedings of the 2013 9th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering, Saint Petersburg, Russia, Aug 18-26, 2013)543-553,2013.Type:Proceedings
Date Reviewed: 10/03/13

I have been writing functional programs for 30 years, first in KRC, then in Miranda, and more recently in Haskell and Erlang. In the past few years, however, something rather remarkable has been happening: the essentials of functional programming have been popping up in more “serious” mainstream languages, including JavaScript, C#, C++, and Java. What is this functional core that’s coming into these languages? It is the ability to compute functions as a part of the work of a program, and to pass these around as parameters or return values of other functions: closures as “first-class citizens,” in Strachey’s words.

But why is this happening? As the authors of this fine paper explain, it is to exploit the parallelism that is now a feature of many computing platforms, from smartphones and tablets, through laptops and desktops, to servers and supercomputers. To give one example, mapping a function across a collection data structure is one of the key parallel patterns, providing the data analog of a linear (control) pipeline.

Given the opportunity, how can we program using these new features? One possibility is to start from scratch with these new constructs, but a more attractive option is to refactor existing code to exploit these features. That is precisely the topic of this paper. The authors show how to identify refactoring opportunities, and what transformations to perform. Moreover, they anatomize some of the attendant difficulties: How should side effects be handled? How do we deal with different scoping regimes between anonymous inner classes and closures? The authors’ work is validated through a set of substantial case studies, and made available through the standard NetBeans distribution.

I would recommend this paper to anyone interested in exploiting the parallelism inherent in many standard programs, as well as those who would like to see a justification for machine-supported refactoring. Finally, it is a remarkable validation of efforts to get students involved in research: two of the four authors took part in undergraduate summer internships.

Reviewer:  Simon Thompson Review #: CR141608 (1312-1110)

Reproduction in whole or in part without permission is prohibited.   Copyright 2024 ComputingReviews.com™
Terms of Use
| Privacy Policy