FANDOM


Prefer enum types to Boolean for function parameters. Limit the use of the Boolean type to function return types.

The reason is because when you have a function call such as:

 package.Configure( handleBlock, userContext, true );

the reader has no idea what ‘true’ means. If the third parameter were of type enum, such as:

enum ConfigureExisting
{
	dontConfigureExisting,
	doConfigureExisting
}

then the client call is more legible:

 package.Configure( handleBlock, userContext, doConfigureExisting );

This page is an example of Catching defects with Patterns.