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,595 other followers

Archive for July 16th, 2015

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

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

 
%d bloggers like this: