From imperative to functional in Java 8: paper review
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 some 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 analogue 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 refactoring opportunities are identified, and what transformations need to be performed. Moreover, they anatomise some of the attendant difficulties: how are side-effects to be handled? how to deal with different scoping regimes between anonymous inner classes and closures? Their work is validated through a set of substantial case studies, and made available through the standard Net Beans distribution.
I would recommend this paper to anyone interested in exploiting the parallelism inherent in many standard programs, as well as anyone who would like to see a justification for machine-supported refactoring. Finally it is a remarkable vindication of getting students involved in research: two of the four authors took part as undergraduate summer interns.