I Dislike Boolean

From Dwayne Wright
Certified FileMaker 9 Developer
www.dwaynewright.com
info@dwaynewright.com

*** warning, a rare editorial rant can be found here ***

Describing what Boolean is and is not ... isn’t just black and white, on or off, 1 or zero. Taking time to do a quick search on Wikipedia, we see a number of categories of Boolean descriptions. I have to admit that I don’t use pure Boolean expressions in my FileMaker development. I have worked with developers that did and I found it uncomfortable. This is because, as odd as it sounds, we may not agree on what is something versus what is nothing.

In many ways, I equate Boolean with SQL. By default, FileMaker does not have a Boolean data type. Boolean is not listed alongside of Text, Number, Date, Time, Timestamp, Container, Calculation or Summary field types. I would even be satisfied if Boolean was a storage type and available to only number fields. As odd as it sounds, for me to take Boolean seriously, it does need to be a data type or storage type. I could get behind the Boolean movement if it was.

Let me take a moment and try to put a Boolean result on my interest in SQL. On the surface, the result is FALSE, I am not remotely interested in SQL development. Many years ago, I chose to dedicate my professional career on FileMaker because I didn’t like the alternatives. However, there is pressure being applied by FileMaker for me to learn SQL in order to coincide with their objectives. Topics of SQL programing and integration are found in their official training materials and, by association, one can assume it may be a part of FileMaker 9 certification criteria.

So although I have a Boolean result of FALSE in my SQL interest, I have a brand new MySQL 5.0 Certification Study Guide at my right elbow and I am on page 64. So evidently I have a TRUE result for my interest but it sure doesn’t feel that way as I have to read about BIT data types associated with values.

Generally speaking in FileMaker, Boolean results should be numeric only values. The way I understood it, any value in a field (including zero) is a TRUE result and the remainder option (no value at all) should return a FALSE result. However, I’m reading otherwise in a recently released FileMaker publication that is saying that a numeric entry of zero is a FALSE result. I am referring specifically to page 649 of the new FileMaker 9 Bible. The first sentence in a discussion of “Working With Boolean Values” tells me that zero is a FALSE result in a number value.

So I would have to assume that a value of zero in a numeric field is the same as no value at all (FALSE) but a value of zero in another other field format has value (TRUE). So when I have to work with the Boolean logic done by another developer, I have to take in account the data type used. This isn’t usually possible with additional clicks of a mouse to uncover it. If someone changes a field type of the field from text to number (or vice versa), any associate Boolean logic may break.

In the case of variables, I would have to assume that zero has a Boolean result of FALSE because variables do not have a specific data type themselves. I guess that it could be wrapped within a function to be seen as a particular type. Yeah! The fun with Boolean seems to be better than a junior high session of spin the bottle.

I have seen developers use Boolean logic on practically every data type. In the consideration of number and calculation fields, I have to make sure that what appears to be zero is zero. It is possible for a result of zero to be displayed but the actual calculated value is something between zero and the actual value shown in the field on the layout.

Really, Boolean is a fantastic opportunity for clean programming by a developer. If that developer is the only developer to ever work on that database, then I guess it is OK. If I’m the developer that is working on the database from another developer and they are consistent in their use of Boolean, that is probably OK.

If I am a developer in the daisy chain of other developers, then I have to groan out loud then I come across Boolean logic in scripting. Still that is better than coming across a developer that thinks “everything is better in an array loaded into a global variable parsed by one of my custom functions” projects. Just had one of those last month and it was a very good thing I was all out of whiskey.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

====================== ADVERTISEMENT ==============================
For more information on FileMaker 9 related training and design services, please visit /training.html
===================================================================