0
Back-2-Basics: Code Contracts<br />
dotNetDave Conference DVD!<br />Packed full of:<br />Videos of all sessions from 2010 & 2011(1)!<br />Slide decks from 201...
Check Out Your Local User Groups!<br />San Diego Cloud Computing User Group<br />www.azureusergroup.com/group/sandiegoazur...
Agenda<br />5<br />
Overview<br />
Introduction to Code Contracts<br />New API + tools from Microsoft<br />System.Diagnostics.Contracts<br />MSIL rewriting<b...
Design by Contract<br />A discipline of analysis, design, implementation, management<br />Applications throughout the soft...
Background<br />Work on “axiomatic semantics”:<br />R.W. Floyd (1967)<br />C.A.R. Hoare (1969, 1972)<br />E.W. Dijkstra (1...
Design by Contract<br />Every software element is intended to satisfy a certain goal, or contract<br />For the benefit of ...
The three questions<br />Precondition<br />What does it expect?<br />What does it promise?<br />What does it maintain?<br ...
12<br />Contracting components<br />Definition of what each element of the functionality:<br />Expects (precondition)<br /...
What we do with contracts<br />Write  better software<br />Analyze<br />Design<br />Reuse<br />Implement<br />Use inherita...
Upcoming SlideShare
Loading in...5
×

Back-2-Basics: Code Contracts

1,202

Published on

Overview on how to use .NET Code Contracts for a better why to do parameter/ value checking.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,202
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Back-2-Basics: Code Contracts"

  1. 1. Back-2-Basics: Code Contracts<br />
  2. 2.
  3. 3. dotNetDave Conference DVD!<br />Packed full of:<br />Videos of all sessions from 2010 & 2011(1)!<br />Slide decks from 2011 & 2010!<br />Demo projects from 2011 & 2010!<br />David McCarter’s .NET interview Questions!<br />Extras<br />Conference Photos from 2010!<br />Surprise videos!<br />Book + DVD $25!<br />Only $15!<br />
  4. 4. Check Out Your Local User Groups!<br />San Diego Cloud Computing User Group<br />www.azureusergroup.com/group/sandiegoazureusergroup<br />San Diego .NET Developers Group<br />www.sddotnetdg.org<br />San Diego .NET User Group<br />www.sandiegodotnet.com<br />San Diego SQL Server User Group<br />www.sdsqlug.org<br />
  5. 5. Agenda<br />5<br />
  6. 6. Overview<br />
  7. 7. Introduction to Code Contracts<br />New API + tools from Microsoft<br />System.Diagnostics.Contracts<br />MSIL rewriting<br />Inspired by Spec#<br />Included in .NET 4.0 but…<br />Download available now for .NET 3.5 and VS2008<br />http://research.microsoft.com/en-us/projects/contracts/<br />
  8. 8. Design by Contract<br />A discipline of analysis, design, implementation, management<br />Applications throughout the software lifecycle:<br />Getting the software right: analysis, design , implementation<br />Debugging & testing<br />Automatic documentation<br />Getting inheritance right<br />Getting exception handling right<br />Maintenance<br />Management<br />
  9. 9. Background<br />Work on “axiomatic semantics”:<br />R.W. Floyd (1967)<br />C.A.R. Hoare (1969, 1972)<br />E.W. Dijkstra (1978)<br />1970’s languages: CLU, Alphard<br />Eiffel (from 1985): connection with object technology<br />90s and onward: contract additions to numerous languages: C++, Java, C#, UML<br />
  10. 10. Design by Contract<br />Every software element is intended to satisfy a certain goal, or contract<br />For the benefit of other software elements (and ultimately of human users)<br />The contract of any software element should be<br />Explicit<br />Part of the software element itself<br />
  11. 11. The three questions<br />Precondition<br />What does it expect?<br />What does it promise?<br />What does it maintain?<br />Postcondition<br />Classinvariant<br />
  12. 12. 12<br />Contracting components<br />Definition of what each element of the functionality:<br />Expects (precondition)<br />Promises (postcondition)<br />Maintains (invariant)<br />Does not have to be complete (but wait)<br />
  13. 13. What we do with contracts<br />Write better software<br />Analyze<br />Design<br />Reuse<br />Implement<br />Use inheritance properly<br />Avoid bugs<br />Document software automatically<br />Help project managers do their job<br />(with run-time monitoring)<br />Perform systematic testing<br />Guide the debugging process<br />13<br />
  14. 14. Real World Contracts!<br />Demo’s<br />
  15. 15. Summary<br />
  16. 16. Resources<br />Microsoft Research<br />http://research.microsoft.com/en-us/projects/contracts/<br />Channel 9 <br />http://channel9.msdn.com/Search/?Term=code%20contracts<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×