Skip to main content

Questions tagged [code-contracts]

Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of preconditions, postconditions, and object invariants. Contracts act as checked documentation of your external and internal APIs.

Filter by
Sorted by
Tagged with
0 votes
0 answers
432 views

Quoting this article - The Other key differences: gRPC vs. REST section (client server coupling): Client-server coupling REST is loosely coupled, which means the client and the server do not need to ...
Veverke's user avatar
  • 541
1 vote
2 answers
1k views

In an in-house solution I've been working on, I've been unable to understand the benefit of how interfaces are frequently implemented throughout the project. Which is as follows: Want to do CRUD ...
8protons's user avatar
  • 1,389
6 votes
6 answers
2k views

I am writing a library for some data structures in C that will be used in embedded systems. I have had issues designing and coming up with a solid error handling plan. This API is only subject to ...
Michael Joseph's user avatar
1 vote
1 answer
930 views

I am not trying to launch a Microservices vs SOA debate but I find hard to understand the following statement: "Microservices architecture does not support contract decoupling, whereas contract ...
Cris's user avatar
  • 323
9 votes
4 answers
3k views

I'm doing an research-project where I'm researching the options to handle changes in an event-driven microservice architecture. So, let's say we got an application where we got four different ...
CGeense's user avatar
  • 191
19 votes
2 answers
12k views

I'm learning about code contracts in .NET, and I'm trying to understand the idea of pure constructors. The code contracts documentation states: All methods that are called within a contract must be ...
p.s.w.g's user avatar
  • 4,215
13 votes
6 answers
4k views

I am a somewhat defensive programmer and a big fan of Microsofts Code Contracts. Now I cannot always use C# and in most languages the only tool I have is assertions. So I usually end up with code ...
ronag's user avatar
  • 1,209
27 votes
4 answers
7k views

I recently stumbled upon Microsoft's framework for code contracts. I read a bit of documentation and found myself constantly asking: "Why would I ever want to do this, as it does not and often cannot ...
Falcon's user avatar
  • 19.4k
3 votes
4 answers
400 views

Michael Perry states in his Pluralsight course on Provable Code (transcript subscription only) that: [T]he burden of proof rests with the caller In a code contract, why must the burden of proof rest ...
Phil Helix's user avatar
  • 1,966
6 votes
1 answer
1k views

Code Exploration (CE) is quite a new term and I wonder if there already any successful examples of implementing this techniques in terms of Continuous Integration principles? In short, Code ...
Ilya Ivanov's user avatar
10 votes
2 answers
652 views

I'm a huge fan of writing asserts, contracts or whatever type of checks available in the language I'm using. One thing that bothers me a bit is that I'm not sure what the common practice is for ...
stijn's user avatar
  • 4,168
4 votes
2 answers
2k views

I often find myself wondering what programming best practices apply to solo programming, since most of the time, I'm the only programmer on a project. I just started experimenting with C# 4.0 Code ...
devuxer's user avatar
  • 676
55 votes
10 answers
38k views

Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How ...
Amit Wadhwa's user avatar
  • 1,962