The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,565 other followers

Boolean parameters usualy are a sign of weakness (via: Avoiding Booleans)

Posted by jpluimers on 2015/07/16

During a recent code review, I bumped into a couple of C# constructors having boolean parameters, leading to the dreaded magic booleans code smell.

This reminded me of the infamous Avoiding Booleans post on Coding Horror, which now is almost 10 years old.

To celebrate, I will coin the Dutch phrase when marking these in a review:

Boolean parameters en literals zijn vrijwel altijd een zwaktebod. Een teken dat beter nagedacht moet worden over het doel van de code.

The Dutch word zwaktebod is used when bidding Bridge using the Acol system. It is the equivalent of a “weak takeout” response to a bid of 1 NT (notrump or no trump, in other languages sometimes sans atout).

The English translation is just about this:

Boolean parameters and literals virtually always are a sign of weakness. It indicates you need to give more thought to the goal of the code.

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: