As I’ve begun writing Tidy Together? (paying subscribers are seeing draft chapters), I’m uncovering tidyings I missed in TF?. Here’s one:
Pattern: You see the same parameters passed through several levels of the call graph but they appear in different orders.
Transformation: Tidy functions you encounter to use the canonical order. You might do this as you are reading when the difference in order confuses you. You might do this before (or after) you modify the function.
When most of the code base is using the canonical order, take one of those Friday afternoons & reconcile the rest.
Another option, if the same list of parameters is used in many places, think about grouping them into one meaningful struct/object.
for example instead of `get_users(offset int, limit int, sort_by string)` -> `get_users(filter obj)`
At least in JS (v8 engine), polymorphic shapes can be very costly. Using monomorphic shapes help the engine a long way so that it doesn't have to do any speculation.
Another good example of performance coming naturally with good, tidy code.