Having following general definitions:
fault - a cause of the error (mistake in coding)
error - incorrect state that may lead to failure
failure - deviation of the service from the correct service
What would be the correct application on the following code:
The code should not allow withdrawal when there is a balance of 100 or less
if (Balance<100)
{
return false;
}
else WithDraw();
So as I understand it, the fault is the missing = operator. But what will be the error and failure?
Fault : It is a condition that causes the software to fail to perform its required function. Error : Refers to difference between Actual Output and Expected output. Failure : It is the inability of a system or component to perform required function according to its specification. IEEE Definitions.
Failure: A difference from the expected result. This is the problem you observe. Fault: The cause of the failure. Error: The mistake which caused the fault to occur. e.g, typos.
Fault is a defect within the system • Examples: – Software bug – Random hardware fault – Memory bit “stuck” – Omission or commission fault in data transfer – Etc.
Fault : It is an incorrect step in any process and data definition in computer program which is responsible of the unintended behavior of any program in the computer. Faults or bugs in a hardware or software may cause errors. An error can be defined as a part of the system which will lead to the failure of the system.
There is a fault (coding or logic mistake) in the code as you said, the missing operator in the comparison. It is possible that no-one ever notices this mistake if there never is balance of exactly 100.
If at some point there is a balance of 100 and the check is done, the error will be exposed. The system will be in incorrect state. It should not have allowed withdrawal, but instead it did. If the withdrawal is allowed, the system is failing to work as it should and user sees the failure.
In this small example it is hard to separate error and failure as the user would probably see the consequences of the error state. If we assume that there is another check somewhere else in the code and because of that the withdrawal is not done, then the system would have been in wrong state (error actualized), but another condition would have masked this one and user would have not seen the failure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With