You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 5That paper is 30 years old. Perhaps some more updated information might be useful? For example, Wikipedia states: "Design by contract does not replace regular testing strategies, such as unit testing, integration testing and system testing. Rather, it complements external testing with internal self-tests that can be activated both for isolated tests and in production code during a test-phase." ...Robert Harvey– Robert Harvey2021-09-30 15:57:25 +00:00Commented Sep 30, 2021 at 15:57
- ... "The advantage of internal self-tests is that they can detect errors before they manifest themselves as invalid results observed by the client. This leads to earlier and more specific error detection."Robert Harvey– Robert Harvey2021-09-30 15:57:33 +00:00Commented Sep 30, 2021 at 15:57
- If your question is "should I test every contract assertion I write," I'd say the answer is "no". In general, don't write trivial unit tests. Forgetting to put in an assertion is morally equivalent to forgetting to put in a field, and you don't write tests for that.Robert Harvey– Robert Harvey2021-09-30 16:09:34 +00:00Commented Sep 30, 2021 at 16:09
- But, @RobertHarvey, if you write an assertion, but you don't have a test for it, what is the purpose of the assertion other than perhaps documentation. I'm failing to see its value. How do you justify that?edalorzo– edalorzo2021-09-30 16:13:27 +00:00Commented Sep 30, 2021 at 16:13
- 1Because if your assertion fails, your development environment stops running. Ergo, you've trapped the problem before it gets to production. Assertions are a form of Code Contract; see here.Robert Harvey– Robert Harvey2021-09-30 16:16:20 +00:00Commented Sep 30, 2021 at 16:16
| Show 8 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you