- Why do functions with many arguments of the same or related types lead to fragile code?
It is easy to miscount arguments, change the wrong argument, or use an argument of the wrong type that happens to convert to the parameter type. Also, adding a new parameter requires changing all function signatures that must pass these parameters along.
- How do aggregate argument objects improve code maintainability and robustness?
The argument values within the aggregate have explicit names. Adding a new value does not require changing the function signatures. Classes made for different groups of arguments have different types and cannot be accidentally mixed.
- What is the named argument idiom and how does it differ from aggregate arguments?
The named argument idiom permits use of temporary aggregate objects. Instead of changing each data member by name, we write a method to...