Bugs
Faults
Failures
Devs
Defect Prevention
Defect Removal
REMEMBER OUR TARGET AS SOFTWARE ENGINEERS: REDUCE AND MINIMIZE IMPACT OF DEFECTS
http://dcoloma.github.io/software-quality/all.html#assertion-driven-development-design-by-contract
Including in the Software as many check as possible...
What if... just in case... for the sake of being on the safe side...
Remember in the Triangle problem we initially checked for <= 0 values and valid triangle sizes...
Real World Contract
when a contract is exhaustive, there is a guarantee that all the obligations are related to the benefits
Software Contract
If all the subtasks are completed correctly, the task will be also finished successfully. If there is a contract between the task and the subtasks, the task will have some guarantees about the completion. Subtasks in software developmentare typically functions, object methods...
Please also think about the Spotify way of working in which they created an architecture that manage every team to deliver different parts of Spotify client independently. It is quite similar, they have divided the main task (the Spotify client) in multiple subtasks (the components of the architecture). If all the components behave properly, the final task will be working properly too.
Preconditions: A certain conditions to be guaranteed on entry by any client module that calls it. It is an obligation for the client module and a benefit for the supplier (no need to handle cases outside of the precondition)
Postconditions: Gurantee a certain property on exit. This is an obligation for the supplier and a benefit for the client.
Class-invariant: Guarantee that certain properties are not going to be changed on exit.
"What happens if one of these conditions fails during execution?"
Up to the developers
Preconditions: A, B, C are valid integer values. A, B, C are bigger than 0. The addition of the smallest ones is bigger than the bigger one.
Postconditions: The result is going to be one these values: EQUILATERAL, ISOSCELES, SCALENE.
Class-invariant: The sizes of the triangle are not going to change
Benefits: If the contract is clear, the getTriangleType could be really small as it just need to focus on the valid cases
This is something that comes directly in some Programming Languages (but not well known) such as Eiffel.
There are libraries that can be used for other programming languages (e.g. AspectJ for Java) to support this kind of approach, most of them are based on assertions (as test frameworks). The idea is assert the values to check if pre-conditions and post-conditions are honoured.
TARGET: INCREASE THE RELIABILITY
BREAK THE BUG/FAILURE CAUSE/EFFECT RELATIONSHIP
TARGET: INCREASE SAFETY
MINIMIZE CONSEQUENCES OF FAILURES
for instance a medical system could not be 100% reliable but it should be 100% safe
REDUNDANCY IS KEY!
RECOVERY BLOCKS
N-VERSION PROGRAMMING
https://www.youtube.com/watch?v=yx_XoqXNtRM
https://www.youtube.com/watch?v=0vZwaMg60FM
https://www.youtube.com/watch?v=aayvBkTGZH0