SlideShare a Scribd company logo
Back-2-Basics: Code Contracts
Back-2-Basics: Code Contracts
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!ExtrasConference Photos from 2010!Surprise videos!Book + DVD $25!Only $15!
Check Out Your Local User Groups!San Diego Cloud Computing User Groupwww.azureusergroup.com/group/sandiegoazureusergroupSan Diego .NET Developers Groupwww.sddotnetdg.orgSan Diego .NET User Groupwww.sandiegodotnet.comSan Diego SQL Server User Groupwww.sdsqlug.org
Agenda5
Overview
Introduction to Code ContractsNew API + tools from MicrosoftSystem.Diagnostics.ContractsMSIL rewritingInspired by Spec#Included in .NET 4.0 but…Download available now for .NET 3.5 and VS2008http://research.microsoft.com/en-us/projects/contracts/
Design by ContractA discipline of analysis, design, implementation, managementApplications throughout the software lifecycle:Getting the software right: analysis, design , implementationDebugging & testingAutomatic documentationGetting inheritance rightGetting exception handling rightMaintenanceManagement
BackgroundWork on “axiomatic semantics”:R.W. Floyd (1967)C.A.R. Hoare (1969, 1972)E.W. Dijkstra (1978)1970’s languages: CLU, AlphardEiffel (from 1985): connection with object technology90s and onward: contract additions to numerous languages: C++, Java, C#, UML
Design by ContractEvery software element is intended to satisfy a certain goal, or contractFor the benefit of other software elements (and ultimately of human users)The contract of any software element should beExplicitPart of the software element itself
The three questionsPreconditionWhat does it expect?What does it promise?What does it maintain?PostconditionClassinvariant
12Contracting componentsDefinition of what each element of the functionality:Expects (precondition)Promises (postcondition)Maintains (invariant)Does not have to be complete (but wait)
What we do with contractsWrite  better softwareAnalyzeDesignReuseImplementUse inheritance properlyAvoid bugsDocument software automaticallyHelp project managers do their job(with run-time monitoring)Perform systematic testingGuide the debugging process13

More Related Content

What's hot (20)

PPTX
SpecFlow Executable Specifications
Sam Leach
 
PDF
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
jbandi
 
PPT
Introduction to Behavior Driven Development
Robin O'Brien
 
PPTX
Introduction to TDD and Mocking
saeed shargi ghazani
 
PPTX
Debugging C# Applications
Jaliya Udagedara
 
PPTX
Test-Driven Development (TDD)
Brian Rasmussen
 
PPTX
Writing clean code in C# and .NET
Dror Helper
 
PPTX
Clean Code II - Dependency Injection
Theo Jungeblut
 
PDF
Improving Automated Tests with Fluent Assertions
TestingCR
 
PPTX
Tdd & clean code
Eyal Vardi
 
PPTX
code documentation
MADUABUM NNANNA
 
PDF
The Zen of Inversion of Control
christopherfairbairn
 
PDF
Clean code & design patterns
Pascal Larocque
 
PDF
ES3-2020-P2 Bowling Game Kata
David Rodenas
 
PDF
STAF 在自動化測試上的延伸應用 -- TMSTAF (TrendMicro STAF)
pycontw
 
PDF
TDD and Simple Design Workshop - Session 1 - March 2019
Paulo Clavijo
 
PDF
Dependency Injection
Giovanni Scerra ☃
 
PPTX
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Theo Jungeblut
 
PPTX
SpecFlow for Agile Teams
Alejandro Ramirez
 
PPTX
Coding Naked
Caleb Jenkins
 
SpecFlow Executable Specifications
Sam Leach
 
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
jbandi
 
Introduction to Behavior Driven Development
Robin O'Brien
 
Introduction to TDD and Mocking
saeed shargi ghazani
 
Debugging C# Applications
Jaliya Udagedara
 
Test-Driven Development (TDD)
Brian Rasmussen
 
Writing clean code in C# and .NET
Dror Helper
 
Clean Code II - Dependency Injection
Theo Jungeblut
 
Improving Automated Tests with Fluent Assertions
TestingCR
 
Tdd & clean code
Eyal Vardi
 
code documentation
MADUABUM NNANNA
 
The Zen of Inversion of Control
christopherfairbairn
 
Clean code & design patterns
Pascal Larocque
 
ES3-2020-P2 Bowling Game Kata
David Rodenas
 
STAF 在自動化測試上的延伸應用 -- TMSTAF (TrendMicro STAF)
pycontw
 
TDD and Simple Design Workshop - Session 1 - March 2019
Paulo Clavijo
 
Dependency Injection
Giovanni Scerra ☃
 
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Theo Jungeblut
 
SpecFlow for Agile Teams
Alejandro Ramirez
 
Coding Naked
Caleb Jenkins
 

Similar to Back-2-Basics: Code Contracts (20)

PPTX
Enhance Your Code Quality with Code Contracts
Eran Stiller
 
PPTX
Code contracts by Dmytro Mindra
Alex Tumanoff
 
PPTX
Design by Contract | Code Contracts in C# .NET
Dariusz Wozniak
 
PPTX
Code contracts
Ashic Mahtab
 
PPTX
Code Contracts
Alexei Skachykhin
 
PPTX
.NET 4.0 Code Contracts (2010)
Koen Metsu
 
PPTX
Better contracts better code - august 2010
Kevin Hazzard
 
PPT
Ooa 2 Post1
Rajesh Kumar
 
ODP
Introduction to Contracts and Functional Contracts
Daniel Prager
 
PPTX
Code Contracts API In .Net
melbournepatterns
 
PPT
Power points re development k's 050311
Roger Royse
 
PPTX
Code Contracts API In .NET
Clarence Bakirtzidis
 
PPT
Lecture10 use case model operation contracts
Shahid Riaz
 
PPTX
Software contracts
NimraGul1
 
PPTX
What’s New and Hot in .NET 4.0
Jess Chadwick
 
PPTX
lec 15.pptxlec 15.pptxlec 15.pptxlec 15.pptxlec 15.pptx
nawasyt700
 
PPTX
DevDays 2011- Let’s get ready for the cloud: Building your applications so th...
Robert MacLean
 
PPT
Thoughtful Software Design
Giovanni Scerra ☃
 
PPTX
Overview of VS2010 and .NET 4.0
Bruce Johnson
 
PDF
DBC Principles
Jackson dos Santos Olveira
 
Enhance Your Code Quality with Code Contracts
Eran Stiller
 
Code contracts by Dmytro Mindra
Alex Tumanoff
 
Design by Contract | Code Contracts in C# .NET
Dariusz Wozniak
 
Code contracts
Ashic Mahtab
 
Code Contracts
Alexei Skachykhin
 
.NET 4.0 Code Contracts (2010)
Koen Metsu
 
Better contracts better code - august 2010
Kevin Hazzard
 
Ooa 2 Post1
Rajesh Kumar
 
Introduction to Contracts and Functional Contracts
Daniel Prager
 
Code Contracts API In .Net
melbournepatterns
 
Power points re development k's 050311
Roger Royse
 
Code Contracts API In .NET
Clarence Bakirtzidis
 
Lecture10 use case model operation contracts
Shahid Riaz
 
Software contracts
NimraGul1
 
What’s New and Hot in .NET 4.0
Jess Chadwick
 
lec 15.pptxlec 15.pptxlec 15.pptxlec 15.pptxlec 15.pptx
nawasyt700
 
DevDays 2011- Let’s get ready for the cloud: Building your applications so th...
Robert MacLean
 
Thoughtful Software Design
Giovanni Scerra ☃
 
Overview of VS2010 and .NET 4.0
Bruce Johnson
 
Ad

More from David McCarter (16)

PPTX
Röck Yoür Technical Interview - V3
David McCarter
 
PDF
.NET Coding Standards For The Real World (2012)
David McCarter
 
PPTX
Back-2-Basics: .NET Coding Standards For The Real World (2011)
David McCarter
 
PPTX
How To Survive The Technical Interview
David McCarter
 
PPTX
Real World API Design Using The Entity Framework Services
David McCarter
 
PPTX
Building nTier Applications with Entity Framework Services
David McCarter
 
PPTX
Code Easier With Visual Studio 2010 & Extensions
David McCarter
 
PPTX
Back-2-Basics: Exception & Event Instrumentation in .NET
David McCarter
 
PPTX
Building nTier Applications with Entity Framework Services (Part 2)
David McCarter
 
PPTX
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
PPTX
Back-2-Basics: .NET Coding Standards For The Real World
David McCarter
 
PPTX
Back-2-Basics: Exception & Event Instrumentation in .NET
David McCarter
 
PPTX
Back-2-Basics: .NET Coding Standards For The Real World
David McCarter
 
PPTX
Building nTier Applications with Entity Framework Services (Part 2)
David McCarter
 
PPTX
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
PPTX
Building N Tier Applications With Entity Framework Services 2010
David McCarter
 
Röck Yoür Technical Interview - V3
David McCarter
 
.NET Coding Standards For The Real World (2012)
David McCarter
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
David McCarter
 
How To Survive The Technical Interview
David McCarter
 
Real World API Design Using The Entity Framework Services
David McCarter
 
Building nTier Applications with Entity Framework Services
David McCarter
 
Code Easier With Visual Studio 2010 & Extensions
David McCarter
 
Back-2-Basics: Exception & Event Instrumentation in .NET
David McCarter
 
Building nTier Applications with Entity Framework Services (Part 2)
David McCarter
 
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
Back-2-Basics: .NET Coding Standards For The Real World
David McCarter
 
Back-2-Basics: Exception & Event Instrumentation in .NET
David McCarter
 
Back-2-Basics: .NET Coding Standards For The Real World
David McCarter
 
Building nTier Applications with Entity Framework Services (Part 2)
David McCarter
 
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
Building N Tier Applications With Entity Framework Services 2010
David McCarter
 
Ad

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Digital Circuits, important subject in CS
contactparinay1
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 

Back-2-Basics: Code Contracts