Abstract

This paper is a synthesis about why and how some functional programming (FP) can be helpful from a program design point-of-view within mainstream object-oriented programming (OOP). We first introduce criteria to ensure that FP-oriented features give an effective functional/method granularity design level within OOP. Next, we list up and discuss the general techniques and design consequences of having such FP capabilities in OOP, i.e. code abstraction/factoring at a function level, generic iterator/loop implementations, operation compositions, sequence comprehensions, partial application and currying, reduction of the number of class definitions, name abstractions, and function-based structural compatibilities. We also stress some of the difficulties of blending FP constructs with OOP, by pointing out potential problems related to design granularity mismatch, architecture non-uniformity and datatype incoherences. Several classic OOP design patterns are analyzed, since FP techniques make alternative implementations manageable: basic cases like Strategies, Commands and Observers, but also Proxies (using functional-based evaluation control) and Visitors (using functional data-driven programming). This synthesis is illustrated with C# 3.0 which offers effective FP-oriented features – based on delegates –, but also by using comparisons with other cross-paradigm languages.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call