-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning Functional Programming in Go
By :

Long parameter lists are typically considered code smell.
How long is too long?
When we look at a parameter list and are unable to keep track of it all, then it's likely too long.
Mind's limit found - 4 things at once
Working memory relates to the information we can pay attention to and grasp. Keeping our parameter lists short helps others easily understand our function's purpose.
Four parameters or fewer is the sweet spot, but seven is the maximum.
Consider our telephone numbers. How many digits? Seven. For example: 867-5309
Why do you think the seven digits are separated into two sets of numbers with the largest set having four digits?
A function signature should not be so long and complicated that we are unable to comprehend it. Keep it simple. Use thoughtful, reasonable, and meaningful parameter names.
Ever noticed that functions with a...