1564.md
February 3, 2022 ยท View on GitHub
Consider the following method signature:
public Customer CreateCustomer(bool platinumLevel)
{
}
On first sight this signature seems perfectly fine, but when calling this method you will lose this purpose completely:
Customer customer = CreateCustomer(true);
Often, a method taking such a bool is doing more than one thing and needs to be refactored into two or more methods. An alternative solution is to replace the bool with an enumeration.