May 08, 2012

Mirko Stocker

Comment on Detecting and Naming Boolean Parameters by Mirco Dotta

It may be nice to also have a Quick Fix that introduce a method, i.e.,

def forceDoSomething() = doSomething(force = true)

Just saying :-)

by Mirco Dotta at May 08, 2012 10:14

May 07, 2012

Mirko Stocker

Comment on Detecting and Naming Boolean Parameters by Mirko Stocker

Oh, three Ints are just as bad :-) in my experience, boolean parameters are typically introduced if a method can be used to do two different things, depending on that boolean flag. That

In Qt, they call this the Boolean Parameter Trap: http://doc.trolltech.com/qq/qq13-apis.html#thebooleanparametertrap

by Mirko Stocker at May 07, 2012 16:49

Comment on Detecting and Naming Boolean Parameters by Jesper Nordenberg

I fail to see why for example having a method taking three boolean parameters is necessarily more confusing to use than one taking three int parameters.

by Jesper Nordenberg at May 07, 2012 16:37

Comment on Detecting and Naming Boolean Parameters by Mirko Stocker

Do you mean why the quickfix is only available for booleans or why boolean arguments shouldn’t be used in APIs? First, I should really make that available for all parameters, that’s a good point :-) For why they’re bad in API, it just makes it really hard to use, it’s often better to use an enum or two separate methods.

by Mirko Stocker at May 07, 2012 16:01