Boolean parameters

less than 1 minute read

It's not fun to look at a method call that sends more than 0 boolean parameters.

Code Snippet
  1. SetBinding(false, false, comboBox);

There is 100% guarantee that you will look for the documentation about this parameters and it'll slow your code reading speed.

Here is a nice way to avoid the unreadable code and keep on using this meaningless Boolean.


Code Snippet
  1. SetBinding(/* auto resolve= */ false, /* two way binding? = */ false, comboBox);


This is not my idea though, it's from Microsoft pdb's, and I think its awesome.

Comments