Tuesday, June 17, 2014

Work Life: False vs Not True in programming and db logic

Oftentimes, I think that false is when logic fails by which I mean a logical contradiction like "true = false". But in reality (like in MS SQL), false is that it is not true. And a lot of logic is also built in this fashion even though most of us do this unconsciously.

In a less technical view, the difference is like saying that someone "unhappy" is sad. Although we typically understand it to be sad (given certain context) but someone could be in other states that are neither happy nor sad, thus being unhappy and not sad. The person could just be indifferent, content, angry, etc.

The minor difference is important particularly with passwords where it either passes or it does not. When it "fails", there is no reason to why it fails except that it is not true. This is important because we do not want to provide a reason to what may be wrong because it may provide a clue.

To further explain the technical logic and design, the minor difference also includes when something cannot be computed like when variables are unknown or conditions that were not met. The most common is with nulls or anything that results in an unknown like dividing by zero. A simple null example is (null = null) which returns false. An 'unknown' example is (1/0 = 1/0) which also returns false.

It is somewhat fascinating to me that classic philosophy does not quite consider the concept of null or unknown... but then, my knowledge on classic philosophy is extremely limited to what I had to read in college as an engineer.