Back-2-Basics: Code Contracts
-
Upload
david-mccarter -
Category
Technology
-
view
1.191 -
download
3
description
Transcript of Back-2-Basics: Code Contracts
About David McCarter
$12
Specia
l
•Microsoft MVP•David McCarter’s .NET Coding Standards• dotnetcodingstandards.notlong.co
m•dotNetTips.com• 700+ Tips, Tricks, Articles, Links!
•Open Source Projects:• http://codeplex.com/dotNetTips
•San Diego .NET Developers Group• www.sddotnetdg.org
•UCSD Classes• http://
dotnetdaveclasses.notlong.com
dotNetDave Conference DVD! Packed full of:
Videos of all sessions from 2010 & 2011(1)!
Slide decks from 2011 & 2010!
Demo projects from 2011 & 2010!
David McCarter’s .NET interview Questions!
Extras Conference Photos
from 2010! Surprise videos!
Only
$15!
Book + DVD $25!
Agenda
Overview Demo’s!
Summary
5
Overview
Introduction to Code Contracts New API + tools from Microsoft System.Diagnostics.Contracts MSIL rewriting Inspired by Spec# Included in .NET 4.0 but…
Download available now for .NET 3.5 and VS2008
http://research.microsoft.com/en-us/projects/contracts/
Design by Contract
A discipline of analysis, design, implementation, management
Applications throughout the software lifecycle: Getting the software right: analysis, design ,
implementation Debugging & testing Automatic documentation Getting inheritance right Getting exception handling right Maintenance Management
Design by Contract
Every software element is intended to satisfy a certain goal, or contract For the benefit of other software
elements (and ultimately of human users)
The contract of any software element should be Explicit Part of the software element itself
The three questions
What does it expect?
What does it promise?
What does it maintain?
Precondition
Postcondition
Classinvariant
Real World Contracts!
Demo’s
Summary
Resources
Microsoft Research http://research.microsoft.com/en-us/
projects/contracts/ Channel 9
http://channel9.msdn.com/Search/?Term=code%20contracts
Questions?•Presentation Downloads• slideshare.com/dotnetdave
•Please Rate My Session:• speakerrate.com/
dotnetdave•David McCarter’s .NET Coding Standards• dotnetcodingstandards.notlong.co
m•Geek Swag• geekstuff.notlong.com