August 2018
Intermediate to advanced
332 pages
9h 12m
English
Suppose we find a function that requires too many parameters. We know that we cannot leave the code base like that, and a refactor is imperative. But, what are the options?
Depending on the case, some of the following rules might apply. This is by no means extensive, but it does provide an idea of how to solve some scenarios that occur quite often.
Sometimes, there is an easy way to change parameters if we can see that most of them belong to a common object. For example, consider a function call like this one:
track_request(request.headers, request.ip_addr, request.request_id)
Now, the function might or might not take additional arguments, but something is really obvious here: all of ...