what is the point of checking a third state when a third state is logically impossible?

What about a Boolean? that allows for a NULL state that is neither true nor false. Now what should the software do? Some software has to be highly crash-resistant like pacemakers. Ever seen someone add a column to a database that was a Boolean and initialize the current data to NULL initially? I know I've seen it.

Here are a few links that discuss what it means to be robust in terms of software:

  • Robust Programming
  • Robust Definition
  • Robustness, the forgotten code quality.
  • How to write robust code

If you think there is one universally agreed upon definition of "robust" here, good luck. There can be some synonyms like bomb-proof or idiot-proof. The Duct Tape Programmer would be an example of someone that usually writes robust code at least in my understanding of the terms.

Answer from JB King on Stack Exchange
🌐
Quora
quora.com › What-is-a-robust-language-and-why-is-C-called-a-robust-language
What is a robust language and why is C called a robust language? - Quora
Answer (1 of 3): Robust basically meaning strength in Latin . It's efficiently deal with errors during execution and errorness input of program.When arise a exception than deal with this.
🌐
Wikipedia
en.wikipedia.org › wiki › Robustness_(computer_science)
Robustness (computer science) - Wikipedia
2 weeks ago - One of the main reasons why there is no focus on robustness today is because it is hard to do in a general way. Robust programming is a style of programming that focuses on handling unexpected termination and unexpected actions. It requires code to handle these terminations and actions gracefully ...
🌐
Ucdavis
nob.cs.ucdavis.edu › bishop › secprog › robust.html
Robust Programming - nob.cs.ucdavis.edu!
Robust programming, also called bomb-proof programming, is a style of programming that prevents abnormal termination or unexpected actions. Basically, it requires code to handle bad (invalid or absurd) inputs in a reasonable way.
🌐
LINFO
linfo.org › robust.html
Definition of robust
June 20, 2005 - The word robust, when used with regard to computer software, refers to an operating system or other program that performs well not only under ordinary conditions but also under unusual conditions that stress its designers' assumptions · Software is typically buggy (i.e., contains errors) and ...
Top answer
1 of 10
39

what is the point of checking a third state when a third state is logically impossible?

What about a Boolean? that allows for a NULL state that is neither true nor false. Now what should the software do? Some software has to be highly crash-resistant like pacemakers. Ever seen someone add a column to a database that was a Boolean and initialize the current data to NULL initially? I know I've seen it.

Here are a few links that discuss what it means to be robust in terms of software:

  • Robust Programming
  • Robust Definition
  • Robustness, the forgotten code quality.
  • How to write robust code

If you think there is one universally agreed upon definition of "robust" here, good luck. There can be some synonyms like bomb-proof or idiot-proof. The Duct Tape Programmer would be an example of someone that usually writes robust code at least in my understanding of the terms.

2 of 10
12

For the sake of my discussion a Bool can have 2 states, True or False. Anything else is non-conformance to the programming langugae specification. If your tool chain is non-conformant to its specification, you are hosed no matter what you do. If a developer created a type of Bool that had more than 2 states, it's the last thing he would ever do on my codebase.

Option A.

if (var == true) {
    ...
} else if (var == false) {
    ...
} else {
    ...
}

Option B

if (var == true) {
    ...
} else {
    ...
}

I assert Option B is more robust.....

Any twit can tell you to handle unexpected errors. They are usually trivally easy to detect once you think of them. The example your professior has given is not something that could happen, so it's a very poor example.

A is impossible to test without convoluted test harnesses. If you can't create it, how are you going to test it? If you have not tested the code, how do you know it works? If you don't know it works, then you are not writing robust software. I think they still call that a Catch22 (Great movie, watch it sometime).

Option B is trivial to test.

Next problem, ask you professor this question "What do you want me to do it about it if a Boolean is neither True nor False?" That should lead into an a very interesting discussion.....

Most cases, a core dump is approriate, at worst it annoys the user or costs a lot of money. What if, say, the module is the Space shuttle realtime reentry calculation system? Any answer, no matter how inaccurate, cannot be worse than aborting, which will kill the users. So what to do, if you know the answer might be wrong, go for the 50/50, or abort and go fo the 100% failure. If I was a crew member, I'd take the 50/50.

Option A kills me Option B gives me an even chance of survival.

But wait - it's a simulation of the space shuttle reentry - then what? Abort so you know about it. Sound like a good idea? - NOT - because you need to test with the code you plan to ship.

Option A is better for simluation, but can't be deployed. It's useless Option B is the deployed code so the simulation performs the same as the live systems.

Let's say this was a valid concern. The better solution would be to isolate the error handling from the application logic.

if (var != true || var != false) {
    errorReport("Hell just froze over, var must be true or false")
}
......
if (var == true){
 .... 
} else {
 .... 
}

Futher reading - Therac-25 Xray machine, Ariane 5 Rocket failure and others (Link has many broken links but enough info that Google will help)

🌐
ResearchGate
researchgate.net › publication › 268422674_Robust_Programming_by_Example
(PDF) Robust Programming by Example
January 1, 2013 - Indeed, this code is not robust. The arguments are not checked. Given that · the last two are integers, a caller could easily get the order wrong. The semantics · of the language means that if the second argument is non-zero, the function
🌐
Study.com
study.com › courses › computer science courses › mttc computer science (050): practice & study guide
Characteristics of Robust Programs | Study.com
Create your account · To recap, a program is a collection of computer commands that perform some focused activity. Robust is used to describe something that is active, sturdy, or solid.
🌐
eScholarship
escholarship.org › content › qt6sq2s7d7 › qt6sq2s7d7_noSplash_f0319f041b253830fd875a0b7efc90d1.pdf pdf
Robust Programming by Example Matt Bishop1 and Chip Elliott2
Indeed, this code is not robust. The arguments are not checked. Given that · the last two are integers, a caller could easily get the order wrong. The semantics · of the language means that if the second argument is non-zero, the function
Find elsewhere
🌐
SourceForge
freetype.sourceforge.net › david › reliable-c.html
Robust Design Techniques for C Programs
This paper presents several techniques used to design robust C programs and libraries · Introduction I. Robust Design Techniques 1. Exceptional Conditions 2. Being extremely paranoid 3. Implementing transactions 4. Structured Exception Handling (SEH) 5. Cleanup Stack Exception Handling (CSEH) II.
🌐
TutorialsPoint
tutorialspoint.com › why-is-java-a-robust-programming-language
Why is Java a Robust Programming Language?
August 6, 2024 - Rather, it will suspend or terminate the program and prevent this from causing any damage to the system. Therefore, we are giving you some information about robust programming languages. Robust means strong and healthy where robust programming language refers to a strong programming language.
🌐
LinkedIn
linkedin.com › pulse › why-java-robust-programming-language-suresh-kumar-reddy-v
Why is Java a Robust Programming Language?
July 26, 2020 - ... By clicking Continue, you agree to LinkedIn’s User Agreement, Privacy Policy, and Cookie Policy. ... Dictionary meaning of Robust is “strong and healthy”. Below are the features which make Java Programming language ...
🌐
Learneroo
learneroo.com › modules › 82 › nodes › 428
Introduction to Correctness and Robustness - Learneroo
A program is correct if it accomplishes the task that it was designed to perform. It is robust if it can handle illegal inputs and other unexpected situations in a reasonable way. For example, consider a program that is designed to read some numbers from the user and then print the same numbers ...
🌐
Coding Bytes
codingbytes.com › home › blog › why java is a robust programming language ?
Why Java is a Robust Programming Language ? - Coding Bytes
January 12, 2024 - Robustness is the capacity of a computer system to handle the errors during execution and manage the incorrect input of data. Java is robust because it utilizes strong memory management.
🌐
YouTube
youtube.com › watch
Why #Java is called a robust language? - YouTube
Java is Robust because it is a highly supported language. It is portable across many Operating systems. Java also has features of Automatic memory management...
Published   November 28, 2022
🌐
PrepBytes
prepbytes.com › home › java › robust meaning in java
Robust Meaning in Java
January 24, 2024 - As technology continues to evolve, the robustness of Java remains a cornerstone of its enduring popularity. The ongoing commitment to robust programming practices ensures that Java remains a language of choice for building robust, high-performance applications in various domains. ... Q1: What does "Robust" mean in the context of Java programming?
🌐
Quora
quora.com › What-does-it-mean-for-a-code-to-be-robust
What does it mean for a code to be robust? - Quora
You could have a piece of C++ code that is robust, but when put inside of a webpage or on a web platform, it is no longer robust as a whole. It's a combination of clean code that runs efficiently, and a language and platform that runs efficiently.
🌐
Oracle
oracle.com › java › technical details
The Java Language Environment
The Java run-time system is written in ANSI C with a clean portability boundary which is essentially POSIX-compliant. There are no "implementation-dependent" notes in the Java language specification. Java is intended for developing software that must be robust, highly reliable, and secure, ...
🌐
Quora
quora.com › Why-is-C-known-as-the-robust-language
Why is C known as the robust language? - Quora
Answer (1 of 4): Because, over the years, it’s survived the disdain of everyone who hasn’t used it, and not a few who have. Because it’s versatile enough to be used for just about any computing task you can think of, with varying levels of difficulty, but never impossibility.
🌐
O'Reilly
oreilly.com › library › view › c-high-performance › 9781787120952 › 184ed39d-8095-4909-bc4b-12938e3ac78c.xhtml
Robustness - C++ High Performance [Book] - O'Reilly
January 31, 2018 - That is, the ability to write functions, classes, and libraries that are easy to use and hard to misuse. ... O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and ...
Authors   Viktor SehrBjörn Andrist
Published   2018
Pages   374