design-by-contract Questions

9

Solved

These days I'm used to checking every single precondition for every function since I got the habit from an OS programming course back at uni. On the other hand, at the software engineering c...
Lamphere asked 28/5, 2010 at 11:19

7

Solved

Is there any way to indicate to ReSharper that a null reference won't occur because of Design-by-Contract Requires checking? For example, the following code will raise the warning (Possible 'null' ...

8

Solved

Recently I had an interesting discussion with a colleague about unit tests. We were discussing when maintaining unit tests became less productive, when your contracts change. Perhaps anyone can en...
Chrissychrist asked 3/6, 2010 at 11:32

3

Solved

What is the idiomatic way to check and document function preconditions and postconditions in R? I would consider Eiffel's built in require and ensure constructs or D's in and out blocks state of th...
Carabiniere asked 4/5, 2012 at 3:52

5

Solved

I have been trying to figure out the best practices to write test-friendly code, but more specifically the practices related to object construction. In the blue book we discovered that we should en...

1

Last year I took a class about the Design By Contract methodology. We programmed in C# with the Contract API that Mircosoft Research created, and generated unit tests with PEX. This year, I a...
Touchback asked 25/2, 2012 at 3:38

5

Solved

I am trying to understand where good contracts end and paranoia starts. Really, I just have no idea what good developer should care about and what shall he leave out :) Let's say I have a class t...
Superadd asked 29/11, 2011 at 12:49

3

Solved

Here is my problem. I am a very big fan of Design by contract, I am using this concept especially when developing libraries that can be used by other developers. I just found out a new way of doing...
Cakewalk asked 28/11, 2011 at 18:56

3

Solved

i was reading through the sample code ListAdder, and there are many asserts right after the variable, or used in almost every method, for example : self.formatter = [[[NSNumberFormatter alloc] ini...
Presidium asked 6/10, 2011 at 17:0

3

Solved

I'm working on a couple of C projects and I'd like to use automated theorem proving to validate the code. Ideally I'd just like to use the ATP to validate the functions contracts. Is there any func...
Ungraceful asked 7/5, 2009 at 7:30

12

Solved

While poking around the questions, I recently discovered the assert keyword in Java. At first, I was excited. Something useful I didn't already know! A more efficient way for me to check the validi...
Faceplate asked 3/5, 2010 at 15:36

2

Solved

There are several questions on StackOverflow discussing the question of when one should use an assert statement versus throwing some exception. (Examples here, here, here, here, and here. However,...
Addy asked 16/5, 2011 at 20:54

1

I can't do this with language How to enforce private method since interface methods are only public? so can I use design by contract instead ?
Watson asked 23/4, 2011 at 18:45

3

I know that both Eiffel (the progenitor) and Racket both to implement "Design by Contract" features. Sadly, I am not sure how one would different from the other. Eiffel's DBC is reliant on the OOP ...
Yeargain asked 15/4, 2011 at 2:5

3

Solved

I'm trying to incorporate some design-by-contract techniques into my coding style. Postconditions look a lot to me like embedded unit tests and I'm wondering if my thinking here is on the right tra...
Exaltation asked 20/2, 2011 at 14:54

2

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

6

Solved

Are there any established patterns for checking class invariants in C++? Ideally, the invariants would be automatically checked at the beginning and at the end of each public member function. As f...

10

Solved

Do you use Design by Contract professionally? Is it something you have to do from the beginning of a project, or can you change gears and start to incorporate it into your software developmen...
Shanell asked 25/8, 2008 at 17:26

5

Consider this 2 methods that returns IEnumerable: private IEnumerable<MyClass> GetYieldResult(int qtResult) { for (int i = 0; i < qtResult; i++) { count++; yield return new MyClass(...
Wilhoit asked 29/10, 2010 at 13:13

2

Solved

Coming from a background in Clojure, I am taken with the potential that its pre-/post-conditions provide as a basis for design by contract: ;; sqr.clj (defn sqr [n] {:pre [(not= 0 n) (number? n)...
Erkan asked 24/9, 2010 at 14:22

4

I work in php, and the concept of interfaces seems to me a little useless here. From reading, I understand that interfaces are part of "design by contract", but without at least guaranteeing a retu...
Safelight asked 25/8, 2010 at 16:23

4

I know this question is pretty similar to others that have been posted before but I would like to discuss this topic in a proper way. Do you think that the "obvious" exception should be unit teste...
Groovy asked 23/8, 2010 at 14:57

1

Solved

This is my code: public class RegularPolygon { public int VertexCount; public double SideLength; public RegularPolygon(int vertexCount, double sideLength) { Contract.Requires(vertexCount &gt...

5

Solved

I am implementing my own ArrayList for school purposes, but to spice up things a bit I'm trying to use C# 4.0 Code Contracts. All was fine until I needed to add Contracts to the constructors. Shoul...
Dy asked 4/5, 2010 at 16:51

1

Solved

At face value, it would seem that object initializers present a problem for .net 4.0 "code contracts", where normally the invariant should be established by the time the object constructor is finis...

© 2022 - 2024 — McMap. All rights reserved.