design-by-contract Questions
9
Solved
I wanted to try a little design by contract in my latest C# application and wanted to have syntax akin to:
public string Foo()
{
set {
Assert.IsNotNull(value);
Assert.IsTrue(value.Contains("bar...
Campy asked 4/11, 2008 at 3:50
3
I'm learning how to program but one thing I can't quite get my head around is preconditions and postconditions.
Is an if statement before calling a function considered a precondition, or is there ...
Tael asked 9/2, 2016 at 22:20
4
Solved
Programming by contracts is a modern trend in .NET, but what about libraries/frameworks for code contracts in PHP? What do you think about applicability of this paradigm for PHP?
Googling for "cod...
Klingel asked 25/10, 2010 at 23:58
5
Solved
I recently read a paper that compared Design-by-Contract to Test-Driven-Development. There seems to be lot of overlap, some redundancy, and a little bit of synergy between the DbC and TDD. For exam...
Psychodiagnosis asked 11/5, 2011 at 13:35
5
I am looking to start using DBC on a large number of Python-based projects at work and am wondering what experiences others have had with it. So far my research turned up the following:
http://ww...
Monophony asked 19/12, 2011 at 15:23
8
Solved
Here is the typical way of accomplishing this goal:
public void myContractualMethod(final String x, final Set<String> y) {
if ((x == null) || (x.isEmpty())) {
throw new IllegalArgumentExce...
Grenier asked 27/11, 2009 at 14:28
1
Solved
It is listed as a language with native DbC support on the Wikipedia beside Eiffel and Spec#, but I can't find any mention whatsoever in the docs or in the test suite.
Saltigrade asked 23/7, 2017 at 1:1
10
Solved
A few years ago, I did a survey of DbC packages for Java, and I wasn't wholly satisfied with any of them. Unfortunately I didn't keep good notes on my findings, and I assume things have chang...
Sabec asked 2/7, 2009 at 17:38
2
Solved
Below is a very simple example. When I turn on the static analysis warnings, I still get
Warning CodeContracts: ensures unproven: Contract.Result() != string.Empty
on the line
return string.Fo...
Polson asked 18/11, 2010 at 22:32
1
Solved
This question is about coding conventions, best practices, and style in production, mission-critical Common-Lisp code. I perused Google's Common-Lisp Style Guide, but didn't find anything clearly a...
Westerfield asked 5/12, 2015 at 15:15
2
Consider this immutable type:
public class Settings
{
public string Path { get; private set; }
[ContractInvariantMethod]
private void ObjectInvariants()
{
Contract.Invariant(Path != null);
...
Calvert asked 29/7, 2010 at 14:19
2
Solved
Does Swift provide a native Design by Contract support? I understand that it can be done during runtime through assertions, but could it be done during compile time? Or, are there any external plug...
Disagreement asked 4/8, 2015 at 19:11
3
I read about contracts in Thoughts about C++17 by B. Stroustrup and assisted a small presentation talking about them but I am not sure I have understood them really.
So I have some interrogations a...
Pascha asked 9/7, 2015 at 12:13
9
Solved
You may think this question is like this question asked on StackOverflow earlier. But I am trying to look at things differently.
In TDD, we write tests that include different conditions, criteria,...
Langan asked 26/1, 2009 at 20:57
8
Solved
I'm working on improving our group's development process, and I'm considering how best to implement Design By Contract with Test-Driven Development. It seems the two techniques have a lot of ...
Blowsy asked 27/12, 2008 at 2:48
8
Method signature in Java:
public List<String> getFilesIn(List<File> directories)
similar one in ruby
def get_files_in(directories)
In the case of Java, the type system gives me in...
Shirley asked 7/10, 2008 at 2:56
5
Solved
Do you often see in API documentation (as in 'javadoc of public functions' for example) the description of "value limits" as well as the classic documentation ?
Note: I am not talking about commen...
Reiter asked 14/9, 2008 at 20:13
2
Solved
It seems that NotNull and ContractAnnotation("key: null => halt") are fairly similar in their effect on R#. Is there something that I am missing? Should I always apply both?
Bibbye asked 1/6, 2014 at 21:16
5
This is for a java class I'm taking. The book mentions preconditions and postconditions but doesn't give any examples how to code them. It goes on to talk about asserts, I have that down, but the a...
Henandchickens asked 18/11, 2012 at 18:53
6
Solved
Is there any library that aids in implementing the design by contract principle in a C++ application?
In particular, I'm looking for a library that facilities the usage of the principle, som...
Tart asked 24/7, 2009 at 6:58
14
Solved
When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on its responsibilities, right? The two most prominent ways to ...
Doyledoyley asked 22/9, 2008 at 19:57
3
Solved
This is actually a design question.
I'm wondering if Spring3.0 REST web services that carries JSON payload provide some kind of data contract similar to traditional web services which follows contr...
Enclasp asked 17/12, 2010 at 10:6
18
Solved
What are some guidelines for when it is not necessary to check for a null?
A lot of the inherited code I've been working on as of late has null-checks ad nauseam. Null checks on trivial functions,...
Cromlech asked 19/11, 2008 at 17:39
3
Solved
I am interested in the Design by Contract approach. It seems that for preconditions checked exceptions must be used to enforce them.
But for post-conditions and class-invariants I think that assert...
Pompey asked 25/12, 2012 at 18:31
4
Solved
We've got an OO codebase where in quite a lot of cases hashcode() and equals() simply don't work, mostly for the following reason:
There is no way to extend an
instantiable class and add a valu...
Suggestible asked 5/2, 2010 at 7:11
1 Next >
© 2022 - 2024 — McMap. All rights reserved.