Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fault/error/failure in this example [closed]

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?

like image 465
John V Avatar asked Aug 06 '12 09:08

John V


People also ask

What is fault and failure with an example?

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.

What does fault failure and error mean?

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.

What is example of fault in software testing?

Fault is a defect within the system • Examples: – Software bug – Random hardware fault – Memory bit “stuck” – Omission or commission fault in data transfer – Etc.

What is fault and error in software engineering?

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.


1 Answers

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.

like image 152
Edu Avatar answered Feb 03 '23 12:02

Edu