Bryan Martin
Feb 16, 2021

--

This advice can be misleading. The arguments accepted in a function should correlate with the purpose of function. If there are more than three arguments and they can be related conceptually (i.e. you can give it a good name) then sure create a class/struct/object to contain them. if you're just taking unrelated items and throwing into a single use 'args' type of class to reduce the number of arguments, then you're not really practicing clean code. It's like when my daughter cleans her room by shoving everything in the closet and closing the door.

--

--

No responses yet