How to make long parameter lists readable?
coding-style, readability
Solution
For this kind of situation, I tend to format it like this:
SomeClass[string] someFunction(
SomeClass!(TemplateParam) foo,
string[][string] someAA,
uint[] dataToProcess,
SomeEnumType flag
)
{
// Do stuff.
}
Problem
I've developed a natural aversion to long parameter lists in functions. While this is to some extent a good thing, sometimes long parameter lists are the lesser of two evils compared to code duplication or ridiculously long functions due to "manual inlining". What's a good way to at least make some of these monstrosities human-readable? For example: ``` SomeClass[string] someFunction(SomeClass!(TemplateParam) foo, string[][string] someAA, uint[] dataToProcess, SomeEnumType flag) { // Do stuff. } ``` This doesn't score high on the readability scale, but four parameters is pretty reasonable in a lot of cases.