Skip to Content
Learning Functional Programming in Go
book

Learning Functional Programming in Go

by Lex Sheehan
November 2017
Intermediate to advanced
670 pages
17h 35m
English
Packt Publishing
Content preview from Learning Functional Programming in Go

Refactoring long parameter lists

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.

https://www.livescience.com/2493-mind-limit-4.html

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?

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781787281394Supplemental Content