what is the difference between precondition and postcondition
Answers
Answered by
1
Answer:
As we will see, the two statements work together: The precondition indicates what must be true before the function is called. The postcondition indicates what will be true when the function finishes its work.
A pre condition is something that must be true before the use case is invoked. e.g. a precondition for a use case "Buy Book on WebSite" might be "The user has accessed the website and wants to buy a book".
A post condition is something that must be true after the use case is finished. e.g. The user has successfully purchased a book.
Explanation:
HYY MATE HOPE IT HELPS YOU ALOT AND PLEASE MARK ME AS BRAINIEST AND FOLLOW ME
Answered by
2
- A precondition is a condition, or a predicate, that must be true before a method runs for it to work.
- In other words, the method tells clients, “this is what I expect from you”. So, the method we are calling is expecting something to be in place before or at the point of the method being called.
- The operation is not guaranteed to perform as it should unless the precondition has been met.
- A postcondition is a condition, or a predicate, that can be guaranteed after a method is finished.
- In other words, the method tells clients, “this is what I promise to do for you”.
- If the operation is correct and the precondition(s) met, then the postcondition is guaranteed to be true.
Similar questions
English,
2 months ago
English,
2 months ago
Computer Science,
4 months ago
English,
9 months ago
English,
9 months ago