Last week, we treated a case where the boolean values “false” and “undefined” could be safely assumed to be the same and offered a way to do so easily.
In this week’s FAC (Friday Afternoon Contemplation), we will look at a case where we can’t. Let’s jump right in with, again, an over-the-top example to make things very, very clear.
Suppose, you are contracted to develop an application for the police which, among other things, holds data to issue or deny a “Certificate of good behavior” (this really exists in many countries, especially for people who will work with children).
In your application form, you put this:
On request, someone retrieves the data for a certain applicant, sees the above checkbox and since it is not checked, fires up a word processor to issue the certificate. Later on, it is established that the certificate should not have been issued, because the person in this case WAS convicted before, the information was just not entered in the system yet ("undefined").
So what happened here? Basically, the developer tried to tie a 3-valued database element (a boolean) to a 2-valued interface element (the checkbox). Something MUST get lost in translation if this is tried. And it did.
Many development environments offer a VISUALLY 2-state checkbox (checked/unchecked), like Wix. When it is tied to a database boolean (which we now know it can be 3-valued), the states “false” and “undefined” are both represented as “not checked”.
Other environments try to solve this problem by offering a visually 3-state checkbox, usually checked (true), unchecked (false) and unchecked with a Grey background (undefined).
Other interface elements, like the “switch” have similar behavior. The Wix switch is 2-state, but the Google switch can be 3-state (left, right and in the middle).
It is still questionable if this really helps, if this is good enough to focus user’s the attention to the fact that we are dealing with 3 states, not 2. That is why there is a whole school out there which refuses to use checkboxes whatsoever, because of this problem.
Myself, I do not belong to that school. If the values “false” and “undefined” can safely be assumed to reflect the same state (like we saw last week), I use a checkbox. But, in the case we described today, we cannot assume this and it would have been better to use a simple dropdown with the options “Yes”/”No”/”Unknown” (or any other order). It is almost impossible to interpret this wrongly. If the developer had used this, the certificate would not have been issued before any more research had been done.
In short: be very careful with checkboxes tied to a boolean database. If you cannot safely assume that the values “false” and “undefined” are identical, then don’t use it and use a dropdown with 3 options instead.