Refactoring Toward Pure Functions
Learn about refactoring logic into pure functions to simplify testing.
We'll cover the following
Function calls to external dependency
When code has an external dependency, it rarely acts as a straight pass-through of the values of that dependency. Mostly, when a dependency is called, the response is manipulated before returning the result to the function call. The more manipulation our code does of that data, the better a candidate our code is for refactoring the logic into a pure function.
Let’s look at a visual representation of a function that calls out to a dependency and manipulate that data before returning its response.
Get hands-on with 1400+ tech skills courses.