Ways to Refactor Toggle/Boolean Parameters in C++--Bartlomiej Filipek

What's your preferred way?

Ways to Refactor Toggle/Boolean Parameters in C++

by Bartlomiej Filipek

From the article:

Boolean parameters in a function might be misleading and decrease its readability. If you have a poorly named function like:

DoImportantStuff(true, false, true, false);

As you can imagine, it’s not clear what all those parameters mean? What’s the first true? What does the last false mean? Can we improve code in such cases?

Let’s have a look at possible improvements...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.