Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Assertion (software development)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assertions in design by contract === Assertions can function as a form of documentation: they can describe the state the code expects to find before it runs (its [[precondition]]s), and the state the code expects to result in when it is finished running ([[postcondition]]s); they can also specify [[invariant (computer science)|invariants]] of a [[Class (computer science)|class]]. [[Eiffel (programming language)|Eiffel]] integrates such assertions into the language and automatically extracts them to document the class. This forms an important part of the method of [[design by contract]]. This approach is also useful in languages that do not explicitly support it: the advantage of using assertion statements rather than assertions in [[comment (computer programming)|comments]] is that the program can check the assertions every time it runs; if the assertion no longer holds, an error can be reported. This prevents the code from getting out of sync with the assertions.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)