Array Refactoring Patterns
You may have probably heard of functional programming many times, however, if you are starting in the world of development or
you come from object oriented programming, you will not know with certainty what it is about.
Let’s begging with a basic definition, since the aim of this term is creating a functionality based on programming methods,
it receives a few entries params, in order to return a value, at this stage it doesn’t exist side effects,
it means that values are immutable. Functions that fulfil these requirements are called pure functions.
At programming languages as
forEach, etc, this operations are called
and have been created to work over list of values (arrays).
Of course not. The fact that they exist does not mean that these operators will be the solution to resolve every programmatic
problem. However, they are a tool that will protect you from several errors as mutability of values, hoisting errors
or just to improve the readability when you have enough experience.
When making TDD, it is not a good option to focus our code on a functional operators since it will close our code design to this solution,
conversely, in a mature version of the code or when we some patterns match, is a good point to apply this solution and couple to our code.