Software Engineering
Home Planning Requirements Writing Hazard Analysis Requirement Analysis Config Control Software Design Software Testing Software Standards Basic Logic

Basic Logic

Whenever possible, a test methodology should be based on sound logic, rather than gut feeling. A review of basic logic and hypothesis testing (without the statistics) shows the fundamental logic behind the two basic approaches to testing: Prescriptive and Descriptive. I also show why the two approaches are somewhat mutually exclusive - you should pick one and forego the other. Logic also helps to understand which type of testing best suits your business needs - is schedule or quality the most important aspect of your project?

Logic has its origins with Aristotle - who established the foundation for binary logic, which has found application in hypothesis testing and computers. Binary logic has limitations, but hypothesis testing and the field of statistics has managed to quantify much of the uncertainty that results from binary logic. As a result, the Binary Logic of Aristotle is well suited to software test design, where the answer is binary: did the test Pass or Fail? A software defect either exists or it does not exist.

(For you "fuzzy logic" fans, mathematician Bertrand Russell once wrote that "Aristotle forged the chains that bound men's minds for two thousand years." Binary Logic is only a subset of Logic, just like Newton's physics is a subset of the much larger field of Physics that was pioneered by people like Albert Einstein.)

Another good source of information on logic and logical arguments is Wikipedia, the free, online encyclopedia.

Aristotle's logic was enhanced by later philosophers, who added formal notations and also the concept that logic is meaningless unless its statements are actually true. For example, the statement "my house is red" is true IF and ONLY IF my house is actually red. In this case, I already know the color of my house so I know if the statement is true or false. However, what if I did not know?

For purists in logic, the logic behind software testing is more simliar to inuitionist logic than classical logic; in that it is ultimately concerned about the truth of its premises and conclusions - not just that a conclusion exists.

I can make the statement "If I flip a coin, it will come up heads half the time." I can even provide a logical argument that "proves" this statement to be true. However, the statement is only true if, in fact, the coin really does come up heads half the time. If I flip the coin ten times I might get 6 heads and 4 tails. Does that make my original statement false? And what if the coin is weighted or double-headed? This is where logic enters - hypothesis testing can make use of statistics and calculate the possibility that my statement is incorrect.

Note: Hypothesis testing, which is covered in this overview of Logic, does not claim to say that a proposition is Correct. As we will learn later, it can only state that the proposition is either False, or we cannot prove it to be False. In other words, hypothesis testing either rejects or fails to reject a proposition.

So what is the purpose of logic? The purpose is to be confident that we can draw correct conclusions from our premises. This involves creating propositions and determining their truth or falsehood.

Remember - according to Aristotle, a thing must either be "True" or "Not True" - never both (Law of Bivalence). His Law of the Excluded Middle further states that "A OR NOT A = TRUE". Therefore, if A is True, then NOT A can only be False, and vice versa, and A cannot be anything except either True or False. Since "NOT True = False", by taking the DeMorgan inverse of TRUE, the following statement is also true: "A AND NOT A = FALSE". Therefore, according to Aristotle, a thing either is or is not. It cannot be both, and it cannot be neither.

Since software either contains a defect or does not, and a test either passes or fails, Binary Logic is fine for software test design. (And to think, Aristotle didn't even know about software!)