Questions tagged [contracts]

63 questions
15
votes
8 answers

Should a company prevent employees from publishing an app in an appstore in their free time?

My company is trying to pass a policy forbidding distribution of any application (even free) in any appstore for all developers. Their reasoning is that "outside work activities create a conflict of interest". They don't want that "you use your…
Tommy
  • 1,219
  • 11
  • 18
14
votes
1 answer

Finding software development contracts

For the last few years I've been working as a self-employed software developer. Doing various gigs as they came my way. For the most part I've been fairly lucky, as my own personal network has yielded all the work I need to sustain myself and then…
Mike
  • 58,961
  • 76
  • 175
  • 221
12
votes
1 answer

When is ->i actually useful in racket?

I've been going through Contracts in the Racket Guide. The ->i construct allows one to place arbitrary constraints on the input/output of a function. For example, I could have an unzip function that takes a list of pairs and returns two lists. Using…
Luke Miles
  • 941
  • 9
  • 19
11
votes
1 answer

Use of System.Diagnostics.Contract in Release builds

I previously saw a thread on StackOverflow that had some discussion on this, however I am unable to find it again! I am interested to know if the System.Diagnostics.Contract classes should be used in 'real code', ie a release build of production…
user935653
  • 143
  • 7
8
votes
1 answer

How do I use code contracts in .NET 4.0 without making my code look cluttered?

I have started using Code Contracts and have found that it makes it difficult to immediately spot the 'guts' of a method. Take this (very simple) example: public static void UserAddNew(string domain, string username, string displayName) { …
8
votes
1 answer

difference in Contract.Requires and Contract.Ensures

I've looked up the difference on the microsoft site but can't really see the difference. links to the website are below Contracts.Ensures Contract.Requires Any additional explaination would be great Using visual studio c#
7
votes
4 answers

A good assert class for production use? Java's equivalent of Groovy's PowerAssert?

I don't like the java assert keyword, because it is not always enabled in production code. I am looking for a good "ProductionAssert" class to use, that always runs the noted assertions. One candidate is Guava's Preconditions. It's decent, but a bit…
ripper234
  • 222,824
  • 274
  • 634
  • 905
7
votes
4 answers

Code Contract Best Practices

I have several questions regarding code contracts, and the best practices for their usage. Lets say we have a class, with several properties (see below for example): class Class1 { // Fields private string _property1; //Required for…
7
votes
4 answers

WCF - multiple service contracts using pretty same data contracts

I have a new question for WCF gurus. So, I have a class User which is close to the 'User' representation from the DB which I use for database operations. Now, I would like to have 2 different service contracts that use this class as data contract,…
Learner
  • 3,297
  • 4
  • 37
  • 62
6
votes
3 answers

Only an absolute URI can be used as a base address

Please help getting exception at using (ServiceHost host = new ServiceHost(typeof(HelloService.HelloService))) in the below code Exception : Only an absolute URI can be used as a base address WCF Host Application class Program { …
Bhuwan Pandey
  • 514
  • 1
  • 6
  • 19
5
votes
2 answers

How do you use CodePro's contracts in Eclipse?

I thought I understood CodePro's contracts, but they seem to have no effect. For example: public class ContractTest { private int number; /** * @pre inputNumber > 0 * * Alternatively: * @post number > 0 */ …
Kevin
  • 4,070
  • 4
  • 45
  • 67
5
votes
0 answers

Laravel 5 Error - Declaration of Illuminate\Container\Container::make() must be compatible with Illuminate\Contracts\Container\Container::make

After composer update and installing contracts I get this error: Fatal error: Declaration of Illuminate\Container\Container::make() must be compatible with Illuminate\Contracts\Container\Container::make($abstract, array $parameters = Array) in…
user4274597
5
votes
1 answer

More readable messages with :pre and :post?

In clojure I am using :pre like this user=> (defn cannot-take-empty [x] {:pre [((complement empty?) x)]} 1) #'user/cannot-take-empty user=> (cannot-take-empty #{}) AssertionError Assert failed: ((complement empty?) x) user/cannot-take-empty…
George Simms
  • 3,930
  • 4
  • 21
  • 35
5
votes
3 answers

How can I meaningfully use precondition contracts in D interfaces?

When I override functions in D with "in" contracts, then the inherited "in" contracts are checked. If they fail, then the overridden "in" contracts are checked. If I don't specify any in contract, then it is interpreted as if there is an empty "in"…
Ralph Tandetzky
  • 22,780
  • 11
  • 73
  • 120
4
votes
2 answers

WCF - handle versioning

If I need to go from this service contract: [ServiceContract(Namespace="http://api.x.com/Svc1")] public interface IService1 { [OperationContract(Name = "AddCustomer")] bool AddCustomer(DTOCustomer1 customer); } to this:…
Learner
  • 3,297
  • 4
  • 37
  • 62
1
2 3 4 5