Higher-Order Programming
Higher-order programming means that programs, and specifically functions, can operate on other programs or functions, as opposed to first-order programming, where functions operate on data elements such as strings, numbers, and data structures. In practice, it means that a function can take some programming logic as a parameter (another function) and/or return some programming logic to be eventually executed. It is a powerful feature that allows us to compose single, modular units of logic in our programs to reduce duplication and promote the reusability of code.
Writing simpler functions increases their modularity. We want to create simple units of functionality that can be used as small bricks to build our programs with. Writing pure functions reduces the complexity of those bricks, and allows us to craft better, sturdier programs. Pure functions are functions that don't alter the state of our program – they produce no side effects; a pure...