Functional Programming #
An Old Paradigm for Modern Applications #
Functional programming (FP) is a relatively old concept that traces back to the 1958 Lisp. From the Microservice’s Angle, FP is relevant because it enforces immutability when handling asynchronous events, allowing for parallelization of processes without memory corruption.
Most modern languages now embrace FP concepts. Object-Oriented languages such as Java support lambdas functions to improve state manipulation and multithread programming.
Unlike the Imperative paradigm, the Functional Paradigm allows systems to be composed of functions that can be assigned to variables and passed as parameters. Pure FP directs on building software using deterministic components. Functional systems rely on deterministic operations that do not modify the system’s state directly.
FP depends on chaining operations such as: filter, map, and fold (reduce).
From the development point of view, the FP paradigm can significantly make you more productive by enforcing key “Clean Code” tenants like unit-testing, small code units, and self-documentation through expressions.
The FP paradigm implementations can be “static” (see Haskell, Scala, Java) or “dynamic” (Lisp, Closure, JS) [typed] (https://docs.oracle.com/cd/E57471_01/bigData.100/extensions_bdd/src/cext_transform_typing.html#:~:text=There%20are%20two%20main%20differences,type%20checking%20at%20compile%20time.).
Many see the FRP (functional reactive programming) as a natural evolution of FP to handle asynchronous event processing using the Observables abstraction.