Simplifying functions
Traditionally, computer science students are told to keep their functions simple. It is often said that one function should correspond to one single action. Indeed, the more a function has cyclomatic complexity, the harder it is to reuse, maintain and test. The more a function becomes a purely logical being that has no real-world roots in a clearly identifiable action, the harder it is to grasp and use in combination with other functions.
Functional programming principles
The functional programming (FP) paradigm pushes this reasoning further by considering computational design as being based on mathematical functions and the immutability of state and data. FP's guiding principle is that the entire computer program should be a single, referentially transparent expression. At its core, the concept of FP requires that functions be pure, referentially transparent and free of side effects. A function is pure when, given the same input, it always returns the same output. It...