LA.NET [EN]
Ramblings about C#, .NET and Programming
Browse by Tags
All Tags
»
Design by Contract
(
RSS
)
C#
Code Contracts…are cool again!
Wed, Apr 22 2009 21:49
Why, you ask? Simply because now they’re usable from within any version of Visual Studio (though you’ll only have static checking if you’re using VSTS). I’m not sure on how I missed that announcement (ok, I missed it because I got really “depressed” after the initial requisites for using it and never looked back!), but now I’m really excited and will start migrating...
Read More...
Code contract is out
Wed, Feb 25 2009 18:29
Check the announcement here and the site is here .
Read More...
Contract reference assemblies
Wed, Nov 19 2008 22:29
If you look closely at your bin folder, you’ll see that besides getting your project’s assembly, you’ll also have another assembly with the your_Assembly_name.Contracts.dll name. This assembly is known as the contract reference assembly and it only has the public “interface” of the types defined on your assembly and their respective contracts. Why do we need...
Read More...
Code contracts: the missing methods
Tue, Nov 18 2008 20:58
In the last posts, I’ve been talking extensively about Code Contracts . If you’re a reader of this blog, you know that I’m hooked on it. I’ve just been reviewing the previous posts and I’ve noticed that I didn’t mention the Assert and Assume methods. Both are used for testing state and assumptions on a specific point of the program. As you might expect...
Read More...
Code Contracts and runtime rewriting
Wed, Nov 12 2008 22:43
Today we’re going to keep looking at Code Contracts . Until now, I’ve been concentrating essentially in presenting its use and mentioning how great it is to have static analysis (ie, have something that goes through your code at compile time and detects several places which might breaking existing contracts). Today it’s time to take a look at the advantages associated...
Read More...
Using quantifiers on Code Contracts
Sun, Nov 9 2008 14:25
Code Contracts also supports are quantifiers (with several limitations, as we’ll see). This means that you can check a predicate against elements in a collection or interval. You can use the ForAll method for running a predicate over several elements maintained on an collection or interval. The Exists method will let you apply a predicate and see if there is...
Read More...
Code Contracts and compatibility with existing code
Sat, Nov 8 2008 12:09
Before using Code Contracts , you’ll probably already written several lines of validation code for testing requirements on your methods. I’ll keep using the Person class to illustrate some code that you might have before using the Code Contracts library . So, in the past, you might have something like this: public class Person { ...
Read More...
Adding Code Contracts to your interfaces
Fri, Nov 7 2008 20:52
[Update: I’ve changed the code so that the contract class implements the interface explicitly. This is required for getting static analysis. One more thing: the first release of the project has a bug and even if you implement the interface explicitly, you won’t get static analysis.] One of the interest things Code Contracts lets you do is define additional...
Read More...
More on Code Contracts: out parameters and field access on preconditions
Thu, Nov 6 2008 21:57
In this post we’ll keep looking at how Code Contracts can really help you improve your code. Today, we’ll see how one can use fields and out parameters in contracts. Lets start with fields. Ok, the title is a little misleading…you can use fields in your contract. But what happens when you need to define a contract on an private field from a public method? Well...
Read More...
Code Contracts: don’t use the overloads that receive a string
Thu, Nov 6 2008 21:18
In my first post about Code Contracts I’ve mentioned that in my machine static analysis wasn’t picking up those evident scenarios where the code was breaking the predefined contracts. Today I’ve got the confirmation on the PEX forum (which, btw, is the place where you should post your questions regarding this framework while we don’t have a discussion place for...
Read More...
More on code contracts: checking return values and old values
Thu, Nov 6 2008 21:01
Today I’ll keep writing about the new Code Contracts framework and we’ll see how we can use the write contracts that validate method return values and “old” values. Lets start with method return values… As you might expect, you’re able to refer to return values on your postconditions. To show you the kind of thing you’ll be writing, we will start by changing...
Read More...
More on Code Contracts
Wed, Nov 5 2008 21:51
Yesterday I was really excited after finding out that we’ll finally have a library for performing Design By Contract verifications on our code. Ok, the runtime validations could already be simulated by writing some code (I’ve already written several helpers classes in my current applications), but the truth is that the Code Contracts library adds static verification...
Read More...
Code contracts are here!
Tue, Nov 4 2008 23:25
Ok, I know I’ve asked for design by contract on C# and that didn’t made it into C# 4.0. However, I’ve just discovered something even better (especially if you’re a VB programmer): we’re getting support for it on the form of a library and some msbuild tasks that are able to perform static and runtime analyses. There’s an installation package that should work on...
Read More...
Search
Go
This Blog
Home
Contact
About
Tags
ASP.NET
Books
C#
Design by Contract
Gadgets
Javascript
JQuery
LINQ
Linux
MS AJAX
Multithreading
MVC
NHibernate
PowerShell
S#arp
Silverlight
Software
Tools
Trivia
VS
VS 2010
WCF
WF
Windows 7
WPF
Community
Home
Blogs
Media
Groups
Archives
November 2009 (12)
October 2009 (70)
September 2009 (35)
August 2009 (52)
July 2009 (48)
June 2009 (48)
May 2009 (44)
April 2009 (39)
March 2009 (39)
February 2009 (23)
January 2009 (22)
December 2008 (18)
November 2008 (20)
October 2008 (22)
September 2008 (31)
August 2008 (3)
July 2008 (25)
June 2008 (26)
May 2008 (30)
April 2008 (5)
March 2008 (11)
February 2008 (9)
January 2008 (15)
December 2007 (10)
November 2007 (20)
October 2007 (19)
September 2007 (29)
August 2007 (12)
July 2007 (20)
June 2007 (33)
May 2007 (44)
April 2007 (28)
March 2007 (27)
February 2007 (21)
January 2007 (37)
December 2006 (8)
November 2006 (17)
October 2006 (14)
September 2006 (5)
August 2006 (7)
July 2006 (4)
Syndication
RSS for Posts
Atom
RSS for Comments
Email Notifications
Go
News
My books