THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
 in Andy Leonard (Entire Site) Search

## Andy Leonard

Andy Leonard is an author and engineer who enjoys building and automating data integration solutions. Andy is co-host of the Data Driven podcast. Andy is no longer updating this blog. His current blog is AndyLeonard.blog.

# Some Logic: The Four States of Two-State Logic

This blog has moved! You can find this content at the following new location:

http://andyleonard.blog/2010/01/28/some-logic-the-four-states-of-two-state-logic/

Published Thursday, January 28, 2010 8:00 AM by andyleonard

#### ken ambrose said:

I've learned never to design attributes as two state logic.  No matter how vociferously the users claim there will never be any other states to their data, it is never true.  The ability to persist information about WHY data is missing, or WHY it is not applicable, or additional states or conditions not considered in the orignal analysis, always ends up being important in recording the facts or states of a domain over time.  Four state logic also totally eliminates the need and rationale for allowing nulls, and all the accompanying confusion and hassle that users and stakeholders experience trying to make sense of nulls in databases  after the DB has been in use for a while.

January 28, 2010 6:08 PM

#### Stephen Munson said:

Wow... It's really amazing that you can somehow change a single bit into 4 bits, and suddenly you have only 4 state logic instead of 16 states...

I'm hoping you'll think it through, but binary is ALWAYS JUST two-state logic - end of story.   If you have to add bits to get to describe your four-state deal, you no longer are describing binary logic by itself.  You're describing multiple-bit binary, and the only way to get 4 states is with exactly 2 bits.

In electronics, the ONLY way that a number of states is used to describe a logic gate is for a single bit, or signal.   The moment you combine more than one bit or signal into something with meaning, you no longer are describing something any electrical engineer would use the word states to describe, unless he/she would name the number of states represented by the 2 to the power of the number of bits.

Thus your example is a bit flawed in how it uses a 16-state object to describe 10 meaningful states and 6 meaningless ones, and then calling this 4 states.  Call it semantics if you wish, but if that's how you choose to make viable arguments, you could as easily argue that a nuclear bomb going off is as meaningless as an empty emotional relationship.

Time to give this one a LOT more thought...

January 28, 2010 7:19 PM

#### Karen Lopez said:

I'm supporting a model right now that has all flags implemented as a char() for the same reason. I think this discussion is more about the fact that there are many reasons for NULL and has little to do with bits.

Data can be null because it doesn't apply or because it is unknown.

So in theory you could have the same extra two states on an integer or varchar column as well.

Karen

January 29, 2010 8:19 AM

#### a.m. said:

Wow, I love it when people just completely miss the point... By the way, Andy, I believe Chris Date identified not just two, but 14 different types of missing information. Might want to read some of his articles on the topic.

January 29, 2010 2:24 PM

#### Paul Nielsen said:

Excellent post Andy!

January 29, 2010 2:44 PM

(required)
(required)
Submit

#### News

 My Latest Book: