Long Parameter List: Too Much Information
Long Parameter List
Functions that take too many parameters produce client code that is awkward and difficult to work with.
It's common to see parameter lists grow and grow when a function requires too much data.Callers of the function often have an awkward time assembling all of the data and the resulting code is usually not too pretty.In the example below, 11 parameters are passed into the userManagerCreate(...)
function.
(Ugly wrapping or a horizontal scrollbar are other signs of the awkwardness of this smell.)
static void testCreateUserInGroup()
{
Group* group = groupManagerCreate(TEST_GROUP, false, GROUP_PROFILE_UNLIMITED_LICENSES, "", GROUP_PROFILE_ONE_YEAR, NULL);
user = userManagerCreate(USER_NAME, group, USER_NAME, "joshua", USER_NAME, LANGUAGE, false, false, newDate(), "blah", newDate());
}
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |