Album Cover

Code Smells Java

Close Preview
Long Parameter List
Methods 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 method requires too much data.
Callers of the method 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 UserManager's create(...) method.
(Ugly wrapping or a horizontal scrollbar are other signs of the awkwardness of this smell.)

class OwnershipTest…
	private void createUserInGroup() {
		GroupManager groupManager = new GroupManager();
		Group group = groupManager.create(TEST_GROUP, false, GroupProfile.UNLIMITED_LICENSES, "", GroupProfile.ONE_YEAR, null);
user = userManager.create(USER_NAME, group, USER_NAME, "joshua", USER_NAME, LANGUAGE, false, false, new Date(), "blah", new Date()); }
| Tweet...
Page rating: | Rate this Page