January 16, 2012 2:33 PM

All boolean parameters are anti-patterns? All optional boolean parameters? What’s the alternative?

I'm talking about formal parameters here.


I thought that boolean parameters where OK when they were labeled in some manner (e.g. via an object literal).

Those are not parameters, they are properties of an object parameter (which may conventionally be expressed literallly in the actual argument).


But I always find unlabeled parameters problematic (beyond the first one). Some of it can be mitigated by choosing good function/method names. Furthermore, trailing callable parameters are often self-explanatory.

String-valued parameters are self-documenting when used well. Same goes for enum in C/C++. Just vague true and false parameters, not so much.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to