Files
2026-08-16 19:03:44 +02:00

619 lines
39 KiB
HTML
Vendored
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0109)https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/ -->
<html xmlns="http://www.w3.org/1999/xhtml" class=" sgfcrs idc0_350"><head profile="http://gmpg.org/xfn/11"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="./design-by-contract_files/athena.js.Download" type="text/javascript"></script>
<script type="text/javascript">window.addEventListener('DOMContentLoaded',function(){var v=archive_analytics.values;v.service='wb';v.server_name='wwwb-app215.us.archive.org';v.server_ms=568;archive_analytics.send_pageview({});});</script>
<script type="text/javascript" src="./design-by-contract_files/bundle-playback.js.Download" charset="utf-8"></script>
<script type="text/javascript" src="./design-by-contract_files/wombat.js.Download" charset="utf-8"></script>
<script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script>
<script type="text/javascript" src="./design-by-contract_files/ruffle.js.Download"></script>
<script type="text/javascript">
__wm.init("https://web.archive.org/web");
__wm.wombat("http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/","20100412202601","https://web.archive.org/","web","/_static/",
"1271103961");
</script>
<link rel="stylesheet" type="text/css" href="./design-by-contract_files/banner-styles.css">
<link rel="stylesheet" type="text/css" href="./design-by-contract_files/iconochive.css">
<!-- End Wayback Rewrite JS Include -->
<title>build broken » Design by Contract jetzt auch mit C#</title>
<meta name="generator" content="WordPress abc">
<meta name="theme" content="Mandigo 1.41">
<link rel="stylesheet" href="./design-by-contract_files/style.css" type="text/css" media="screen">
<style type="text/css">
body {
font-family: Arial, Sans-Serif;
background-color: #44484F;
}
a {
font-weight: bold;
}
.narrowcolumn .entry, .widecolumn .entry {
line-height: 1.4em;
}
.inline-widgets #wp-calendar caption, .blogname, .blogdesc {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
.blogname {
font-size: 4em;
margin-top: 15px;
}
.posttitle, #comments, #respond .title, #respond.pre27, #trackbacks {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
.commentlist li, #commentform input, #commentform textarea {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
#commentform p {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
.sidebars {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
#page {
width: 987px;
}
#header {
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/images/header-1024.png);
height: 243px;
width: 987px;
}
#headerimg {
height: 226px;
width: 961px;
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/schemes/orange/images/head-1024.jpg) bottom center no-repeat;
}
#main {
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/images/bg-1024.png);
width: 957px;
}
#footer {
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/images/foot-1024.png);
}
.post {
text-align: justify;
background: #FAFAFA;
border: 1px solid #EEEEEE;
}
#footer {
width: 987px;
}
.sidebars {
background: #EEEEEE;
border: 1px solid #DDDDDD;
}
#sidebar1 .sidebars {
width: 210px;
}
#sidebar2 .sidebars {
width: 210px;
}
.entry img {
float: none;
}
.sidebars li {
list-style-image: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/schemes/orange/images/star.gif);
}
.commentlist {
}
.commentlist li {
list-style: none;
}
#wp-calendar {
margin: 0 !important; margin-top: -1.5em;
}
#wp-calendar caption {
margin-top: -1.4em;
}
/* dirty fix for the event calendar plugin */
div#wp-calendar .nav {
margin: 0;
}
/* end dirty fix */
.datestamp div {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Sans-Serif;
}
.cal3 {
}
.pages {
text-align: right;
}
.pages ul li.has_sub {
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/images/icons/bullet_arrow_right.png) no-repeat center right;
}
.head_overlay {
background: url(https://web.archive.org/web/20100412202601im_/http://blog.aztec-project.org/wp-content/themes/mandigo/images/head_overlay.png);
}
</style>
<link rel="stylesheet" href="./design-by-contract_files/scheme.css" type="text/css" media="screen">
<link rel="alternate" type="application/rss+xml" title="build broken RSS Feed" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/feed/">
<link rel="pingback" href="https://blog.aztec-project.org/xmlrpc.php">
<link rel="alternate" type="application/rss+xml" title="build broken » Design by Contract jetzt auch mit C# Kommentar Feed" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/feed/">
<script type="text/javascript" src="./design-by-contract_files/comment-reply.js.Download"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://blog.aztec-project.org/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://blog.aztec-project.org/wp-includes/wlwmanifest.xml">
<link rel="index" title="build broken" href="https://blog.aztec-project.org/">
<link rel="start" title="Umsetzung des Plug-In-Patterns" href="https://blog.aztec-project.org/2009/06/05/umsetzung-des-plug-in-patterns/">
<link rel="prev" title=".NET Open Space 2009 in Leipzig" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/23/net-open-space-2009-in-leipzig/">
<link rel="next" title="ASP.MVC 2 Vortrag von Albert bei münchener UserGroup" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/30/asp-mvc-2-bei-munchener-usergroup/">
<link rel="canonical" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/">
<script type="text/javascript" src="./design-by-contract_files/jquery.js.Download"></script>
<script type="text/javascript" src="./design-by-contract_files/jquery.ifixpng.js.Download"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<style type="text/css">
.entry img, .entry embed, .entry object { max-width: 880px; width: expression(this.clientWidth > 880 ? 880 : true); }
.entry img { height: auto; }</style>
</head>
<body><!-- BEGIN WAYBACK TOOLBAR INSERT -->
<script>__wm.rw(0);</script>
<div id="wm-ipp-base" lang="en" style="display: block; direction: ltr;"><template shadowrootmode="closed"><div id="wm-ipp" style="position:fixed;left:0;top:0;right:0;">
<div id="donato" style="position:relative;width:100%;">
<div id="donato-base">
<iframe id="donato-if" src="https://archive.org/includes/donate.php?as_page=1&amp;platform=wb&amp;referer=https%3A//web.archive.org/web/20100412202601/http%3A//blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" scrolling="no" frameborder="0" style="width:100%; height:100%">
</iframe>
</div>
</div><div id="wm-ipp-inside">
<div id="wm-toolbar" style="position:relative;display:flex;flex-flow:row nowrap;justify-content:space-between;">
<div id="wm-logo" style="/*width:110px;*/padding-top:12px;">
<a href="https://web.archive.org/web/" title="Wayback Machine home page"><img src="https://web.archive.org/_static/images/toolbar/wayback-toolbar-logo-200.png" srcset="/_static/images/toolbar/wayback-toolbar-logo-100.png, /_static/images/toolbar/wayback-toolbar-logo-150.png 1.5x, /_static/images/toolbar/wayback-toolbar-logo-200.png 2x" alt="Wayback Machine" style="width:100px" border="0"></a>
</div>
<div class="c" style="display:flex;flex-flow:column nowrap;justify-content:space-between;flex:1;">
<form class="u" style="display:flex;flex-direction:row;flex-wrap:nowrap;" target="_top" method="get" action="https://web.archive.org/web/submit" name="wmtb" id="wmtb"><input type="text" name="url" id="wmtbURL" value="http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" onfocus="this.focus();this.select();" style="flex:1;" autocomplete="off"><input type="hidden" name="type" value="replay"><input type="hidden" name="date" value="20100412202601"><input type="submit" value="Go">
</form>
<div style="display:flex;flex-flow:row nowrap;align-items:flex-end;">
<div class="s" id="wm-nav-captures" style="flex:1;"><a class="t" href="https://web.archive.org/web/*/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" title="See a list of every capture for this URL">7 captures</a><div class="r" title="Timespan for captures of this URL">29 Oct 2009 - 7 May 2021</div></div>
<div class="k">
<a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" id="wm-graph-anchor">
<div id="wm-ipp-sparkline" title="Explore captures for this URL" style="position: relative">
<canvas id="wm-sparkline-canvas" width="750" height="27" border="0"></canvas>
<div class="yt" style="display: none; width: 25px; height: 27px;"></div><div class="mt" style="display: none; width: 2px; height: 27px;"></div></div>
</a>
</div>
</div>
</div>
<div class="n">
<table>
<tbody>
<!-- NEXT/PREV MONTH NAV AND MONTH INDICATOR -->
<tr class="m">
<td class="b" nowrap="nowrap"><a href="https://web.archive.org/web/20091029161809/http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/" title="29 Oct 2009"><strong>Oct</strong></a></td>
<td class="c" id="displayMonthEl" title="You are here: 20:26:01 Apr 12, 2010">APR</td>
<td class="f" nowrap="nowrap"><a href="https://web.archive.org/web/20130923052522/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" title="23 Sep 2013"><strong>Sep</strong></a></td>
</tr>
<!-- NEXT/PREV CAPTURE NAV AND DAY OF MONTH INDICATOR -->
<tr class="d">
<td class="b" nowrap="nowrap"><a href="https://web.archive.org/web/20091029161809/http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/" title="16:18:09 Oct 29, 2009"><img src="https://web.archive.org/_static/images/toolbar/wm_tb_prv_on.png" alt="Previous capture" width="14" height="16" border="0"></a></td>
<td class="c" id="displayDayEl" style="width:34px;font-size:22px;white-space:nowrap;" title="You are here: 20:26:01 Apr 12, 2010">12</td>
<td class="f" nowrap="nowrap"><a href="https://web.archive.org/web/20130923052522/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" title="05:25:22 Sep 23, 2013"><img src="https://web.archive.org/_static/images/toolbar/wm_tb_nxt_on.png" alt="Next capture" width="14" height="16" border="0"></a></td>
</tr>
<!-- NEXT/PREV YEAR NAV AND YEAR INDICATOR -->
<tr class="y">
<td class="b" nowrap="nowrap">2009</td>
<td class="c" id="displayYearEl" title="You are here: 20:26:01 Apr 12, 2010">2010</td>
<td class="f" nowrap="nowrap"><a href="https://web.archive.org/web/20130923052522/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" title="23 Sep 2013"><strong>2013</strong></a></td>
</tr>
</tbody>
</table>
</div>
<div class="r" style="display:flex;flex-flow:column nowrap;align-items:flex-end;justify-content:space-between;">
<div id="wm-btns" style="text-align:right;height:23px;">
<span class="xxs">
<div id="wm-save-snapshot-success">success</div>
<div id="wm-save-snapshot-fail">fail</div>
<a id="wm-save-snapshot-open" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#" title="Share via My Web Archive" style="display: none;">
<span class="iconochive-web"></span>
</a>
<a href="https://archive.org/account/login.php" title="Sign In" id="wm-sign-in" style="display: inline-block;">
<span class="iconochive-person"></span>
</a>
<span id="wm-save-snapshot-in-progress" class="iconochive-web" style="display: none;"></span>
</span>
<a class="xxs" href="http://faq.web.archive.org/" title="Get some help using the Wayback Machine" style="top:-6px;"><span class="iconochive-question" style="color:rgb(87,186,244);font-size:160%;"></span></a>
<a id="wm-tb-close" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#close" style="top:-2px;" title="Close the toolbar"><span class="iconochive-remove-circle" style="color:#888888;font-size:240%;"></span></a>
</div>
<div id="wm-share" class="xxs">
<a href="https://web.archive.org/web/20100412202601/http://web.archive.org/screenshot/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" id="wm-screenshot" title="screenshot" style="visibility: hidden;">
<span class="wm-icon-screen-shot"></span>
</a>
<a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#" id="wm-video" title="video">
<span class="iconochive-movies"></span>
</a>
<a id="wm-share-facebook" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#" data-url="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/" title="Share on Facebook" style="margin-right:5px;" target="_blank"><span class="iconochive-facebook" style="color:#3b5998;font-size:160%;"></span></a>
<a id="wm-share-twitter" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#" data-url="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/" title="Share on Twitter" style="margin-right:5px;" target="_blank"><span class="iconochive-twitter" style="color:#1dcaff;font-size:160%;"></span></a>
</div>
<div style="padding-right:2px;text-align:right;white-space:nowrap;">
<a id="wm-expand" class="wm-btn wm-closed" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#expand"><span id="wm-expand-icon" class="iconochive-down-solid"></span> <span class="xxs" style="font-size:80%;">About this capture</span></a>
</div>
</div>
</div>
<div id="wm-capinfo" style="border-top:1px solid #777;display:none; overflow: hidden">
<div id="wm-capinfo-notice" source="api"></div>
<div id="wm-capinfo-collected-by">
<div style="background-color:#666;color:#fff;font-weight:bold;text-align:center">COLLECTED BY</div>
<div style="padding:3px;position:relative" id="wm-collected-by-content">
<div style="display:inline-block;vertical-align:top;width:50%;">
<span class="c-logo" style="background-image:url(https://archive.org/services/img/alexacrawls);"></span>
Organization: <a style="color:#33f;" href="https://archive.org/details/alexacrawls" target="_new"><span class="wm-title">Alexa Crawls</span></a>
<div style="max-height:75px;overflow:hidden;position:relative;">
<div style="position:absolute;top:0;left:0;width:100%;height:75px;background:linear-gradient(to bottom,rgba(255,255,255,0) 0%,rgba(255,255,255,0) 90%,rgba(255,255,255,255) 100%);"></div>
Starting in 1996, <a href="http://www.alexa.com/">Alexa Internet</a> has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to the <a href="http://web.archive.org/">Wayback Machine</a> after an embargo period.
</div>
</div>
<div style="display:inline-block;vertical-align:top;width:49%;">
<span class="c-logo" style="background-image:url(https://archive.org/services/img/alexa_web_2010)"></span>
<div>Collection: <a style="color:#33f;" href="https://archive.org/details/alexa_web_2010" target="_new"><span class="wm-title">alexa_web_2010</span></a></div>
<div style="max-height:75px;overflow:hidden;position:relative;">
<div style="position:absolute;top:0;left:0;width:100%;height:75px;background:linear-gradient(to bottom,rgba(255,255,255,0) 0%,rgba(255,255,255,0) 90%,rgba(255,255,255,255) 100%);"></div>
this data is currently not publicly accessible.
</div>
</div>
</div>
</div>
<div id="wm-capinfo-timestamps">
<div style="background-color:#666;color:#fff;font-weight:bold;text-align:center" title="Timestamps for the elements of this page">TIMESTAMPS</div>
<div>
<div id="wm-capresources" style="margin:0 5px 5px 5px;max-height:250px;overflow-y:scroll !important"></div>
<div id="wm-capresources-loading" style="text-align:left;margin:0 20px 5px 5px;display:none"><img src="https://web.archive.org/_static/images/loading.gif" alt="loading"></div>
</div>
</div>
</div></div></div><link rel="stylesheet" type="text/css" href="./design-by-contract_files/banner-styles.css"><link rel="stylesheet" type="text/css" href="./design-by-contract_files/iconochive.css"><div class="wb-autocomplete-suggestions "></div></template>
</div><div id="wm-ipp-print">The Wayback Machine - https://web.archive.org/web/20100412202601/http://blog.aztec-project.org:80/2009/10/26/design-by-contract-mit-c/</div>
<script type="text/javascript">//<![CDATA[
__wm.bt(750,27,25,2,"web","http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/","20100412202601",1996,"/_static/",["/_static/css/banner-styles.css?v=S1zqJCYt","/_static/css/iconochive.css?v=3PDvdIFv"], false);
__wm.rw(1);
//]]></script>
<!-- END WAYBACK TOOLBAR INSERT -->
<div id="page">
<div id="header" class="png">
<div id="headerimg">
<h1 class="blogname" id="blogname"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/">build broken</a></h1><span class="blogname text-stroke-br">build broken</span><span class="blogname text-stroke-bl">build broken</span><span class="blogname text-stroke-tr">build broken</span><span class="blogname text-stroke-tl">build broken</span>
<h6 class="blogdesc" id="blogdesc">but we can fix it! Sometimes :)</h6><span class="blogdesc text-stroke-br">but we can fix it! Sometimes :)</span><span class="blogdesc text-stroke-bl">but we can fix it! Sometimes :)</span><span class="blogdesc text-stroke-tr">but we can fix it! Sometimes :)</span><span class="blogdesc text-stroke-tl">but we can fix it! Sometimes :)</span>
<ul class="pages png head_overlay">
<li class="page_item"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/">Home</a></li>
<li class="page_item page-item-2"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/about/" title="About">About</a></li>
</ul>
</div>
</div>
<div id="main" class="png">
<table>
<tbody><tr>
<td id="content" class="widecolumn">
<div class="navigation">
<div class="alignleft">«&nbsp;<a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/23/net-open-space-2009-in-leipzig/" rel="prev">.NET Open Space 2009 in Leipzig</a></div>
<div class="alignright"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/30/asp-mvc-2-bei-munchener-usergroup/" rel="next">ASP.MVC 2 Vortrag von Albert bei münchener UserGroup</a>&nbsp;»</div>
</div>
<div class="post" id="post-674">
<div class="postinfo">
<div class="datestamp">
<div>
<span class="cal1 cal1x">Okt</span>
<span class="cal2">26</span>
<span class="cal3">2009</span>
</div>
</div>
<span class="switch-post">
<a href="javascript:toggleSidebars();" class="switch-sidebars"><img src="./design-by-contract_files/bullet_sidebars_hide.png" alt="" class="png"></a><a href="javascript:togglePost(674);" id="switch-post-674"><img src="./design-by-contract_files/bullet_toggle_minus.png" alt="" class="png"></a>
</span>
<h2 class="posttitle"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/" rel="bookmark" title="Permanent Link: Design by Contract jetzt auch mit C#">Design by Contract jetzt auch mit C#</a></h2>
<small>
Geschrieben von <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/author/chi/" title="Artikel von Christina Hirth">Christina Hirth</a> in <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/category/architektur/" title="Alle Artikel in Architektur ansehen" rel="category tag">Architektur</a>, <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/category/clean-code-developing/" title="Alle Artikel in Clean Code Developing ansehen" rel="category tag">Clean Code Developing</a>, tags: <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/tag/dot-net/" rel="tag">.NET</a>, <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/tag/architektur/" rel="tag">Architektur</a>, <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/tag/clean-code/" rel="tag">Clean Code</a> </small>
</div>
<div class="entry">
<p>Bald kommt .NET 4.0 raus, zusammen mit einem für C# neuen Konzept: Kontrakte im Code mit <b>Spec#</b> festzulegen. </p>
<p>Wikipedia definiert DbC folgendermaßen:</p>
<blockquote><p>Design by contract (kurz DbC; englisch Entwurf gemäß Vertrag) oder Programming by Contract ist ein Konzept aus dem Bereich der Softwareentwicklung. Ziel ist das reibungslose Zusammenspiel einzelner Programmmodule durch die Definition formaler „Verträge“ zur Verwendung von Schnittstellen, die über deren statische Definition hinausgehen. Entwickelt und eingeführt wurde es von Bertrand Meyer mit der Entwicklung der Programmiersprache Eiffel.</p></blockquote>
<p><a href="https://web.archive.org/web/20100412202601/http://www.lieser-online.de/blog/" target="_blank">Stefan Lieser</a> hat über das neue Konzept einen sehr guten Artikel in <a href="https://web.archive.org/web/20100412202601/http://www.visualstudio1.de/" target="_blank">www.visualstudio1.de</a> geschrieben, mit Begriffsklärung und Anwendungsbeispiele. Kurz zusammengefasst ist die Rede von Folgendem: anstelle, dass man in jeder Methode auf not-null or not-empty usw. prüft, schreibt man die Erwartungen als Code hin. Diese werden von Tools wie z.B. Resharper erkannt und bei fehlerhaften Aufruf der Methode, wird der Entwickler gewarnt. Am besten finde ich, dass man den Kontrakt-Code z.B. für einen Interface in eine separate Klasse schreiben kann und diese wird durch Attribute (<code>ContractClassFor</code>) gefunden. Also wird dadurch der eigentliche Code nicht größer.</p>
<p>Das soll nicht bedeuten, dass der Entwickler der Methode die Verantwortung von sich schiebt <img src="./design-by-contract_files/icon_wink.gif" alt=";)" class="wp-smiley"> , sondern dass er Bedingungen der “Nutzung” offenlegt, Informationen, die bisher nur durch das Anschauen des Codes oder durch mündliche/schriftliche Mitteilung möglich war. Mit <b>Spec#</b> kann man die <b>Intention-Revealing Interfaces</b> ganz genau schreiben: mit veröffentlichten und kompilierten Bedingungen.</p>
<p><a href="https://web.archive.org/web/20100412202601/http://dotnet-kicks.de/kick/?url=http%3a%2f%2fblog.aztec-project.org%2f2009%2f10%2f26%2fdesign-by-contract-mit-c%2f" target="_blank"><img src="./design-by-contract_files/KickItImageGenerator.ashx" border="0" alt="kick it on dotnet-kicks.de"></a></p>
<p class="postmetadata alt clear">
<small>
Geschrieben am Montag, 26. Oktober 2009 um 10:03 am und ist zu finden in <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/category/architektur/" title="Alle Artikel in Architektur ansehen" rel="category tag">Architektur</a>, <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/category/clean-code-developing/" title="Alle Artikel in Clean Code Developing ansehen" rel="category tag">Clean Code Developing</a>. Du kannst die Antworten zu diesem Thema verfolgen unter <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/feed/">RSS 2.0</a> feed. Du kannst <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#respond">Antwort</a>, oder <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/trackback/" rel="trackback">trackback</a> von deiner Seite.
</small>
</p>
</div>
</div>
<div id="comments">
4 Antworten zu “Design by Contract jetzt auch mit C#”
</div>
<ol class="commentlist" id="commentlist">
<li class="comment even thread-even depth-1 alt" id="comment-67">
<div id="div-comment-67" class="comment-body">
<span class="switch-post"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#"><img src="./design-by-contract_files/bullet_toggle_minus(1).png" alt="" class="png"></a></span><div class="comment-author vcard">
<img alt="" src="./design-by-contract_files/daef1e9cdc6e7023e810849c14a81c98" class="avatar avatar-32 photo" height="32" width="32"> <cite class="fn"><a href="https://web.archive.org/web/20100412202601/http://dotnet-forum.de/blogs/rainerhilmer/default.aspx" rel="external nofollow" class="url">Rainer Hilmer</a></cite> <span class="says">sagt:</span> </div>
<div class="comment-meta commentmetadata"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/comment-page-1/#comment-67">Oktober 26, 2009 um 11:33 am</a></div>
<div class="comment"><p>CodeContracts kommen nicht erst mit .NET Framework 4. Es gibt sie schon eine ganze Weile bei DevLabs. Dieses ist mittlerweile in .NET 4 eingeflossen.<br>
<a href="https://web.archive.org/web/20100412202601/http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx</a><br>
Wer mit der Einflechtung von CodeContracts nicht bis VS2010 warten möchte, kann es sich dort ziehen.</p></div>
<div class="comment"><p>Ich habe dazu auch eine Quick Reference geschrieben.<br>
<a href="https://web.archive.org/web/20100412202601/http://dotnet-forum.de/blogs/rainerhilmer/archive/2009/10/15/code-contracts-quick-reference.aspx" rel="nofollow">http://dotnet-forum.de/blogs/rainerhilmer/archive/2009/10/15/code-contracts-quick-reference.aspx</a></p></div>
<div class="comment"><div class="reply">
</div></div>
</div>
</li>
<li class="comment byuser comment-author-chi bypostauthor odd alt thread-odd thread-alt depth-1" id="comment-68">
<div id="div-comment-68" class="comment-body">
<span class="switch-post"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#"><img src="./design-by-contract_files/bullet_toggle_minus(1).png" alt="" class="png"></a></span><div class="comment-author vcard">
<img alt="" src="./design-by-contract_files/fa211026bf1d16166d537ba69b2f6f23.jpeg" class="avatar avatar-32 photo" height="32" width="32"> <cite class="fn">Christina Hirth</cite> <span class="says">sagt:</span> </div>
<div class="comment-meta commentmetadata"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/comment-page-1/#comment-68">Oktober 26, 2009 um 1:55 pm</a></div>
<div class="comment"><p>Hallo Rainer,</p></div>
<div class="comment"><p>danke für den Hinweis, das ist mir schon bekannt. Steht auch in den o.g. Artikel, den ich hier nicht abschreiben wollte, er ist ja nicht von mir <img src="./design-by-contract_files/icon_smile.gif" alt=":)" class="wp-smiley"> . Außerdem würde ich ja nie über Code schreiben, den ich selbst nicht ausprobiert habe, also ist es klar, dass es jetzt schon geht.<br>
Der andere Grund, warum ich das nicht speziell erwähnt habe, ist, dass es z.Z. zwar möglich ist, das Konzept anzuwenden, aber die Unterstützung seitens VS fehlt, es sei denn, du nutzt TSF.</p></div>
<div class="comment"><p>Mir ging es eigentlich darum, dass es endlich möglich ist, Anforderungen als Code zu implementieren und als solche schriftlich festhalten, verfolgen und auswerten.</p></div>
<div class="comment"><div class="reply">
</div></div>
</div>
</li>
<li class="comment even thread-even depth-1 alt" id="comment-69">
<div id="div-comment-69" class="comment-body">
<span class="switch-post"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#"><img src="./design-by-contract_files/bullet_toggle_minus(1).png" alt="" class="png"></a></span><div class="comment-author vcard">
<img alt="" src="./design-by-contract_files/daef1e9cdc6e7023e810849c14a81c98" class="avatar avatar-32 photo" height="32" width="32"> <cite class="fn"><a href="https://web.archive.org/web/20100412202601/http://dotnet-forum.de/blogs/rainerhilmer/default.aspx" rel="external nofollow" class="url">Rainer Hilmer</a></cite> <span class="says">sagt:</span> </div>
<div class="comment-meta commentmetadata"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/comment-page-1/#comment-69">Oktober 26, 2009 um 3:29 pm</a></div>
<div class="comment"><p>Hallo Christina,<br>
ich habe eine gute Nachricht: Es gibt eine kostenfreie academic license, die den static Checker auch auf VS 2008 pro zur Verfügung stellt (mit der aktuellen Version vom 24.10.2009 auch auf VS2010 Beta 2). Die academic license darf nur nicht kommerziell eingesetzt werden.<br>
<a href="https://web.archive.org/web/20100412202601/http://research.microsoft.com/en-us/downloads/4ed7dd5f-490b-489e-8ca8-109324279968/default.aspx" rel="nofollow">http://research.microsoft.com/en-us/downloads/4ed7dd5f-490b-489e-8ca8-109324279968/default.aspx</a></p></div>
<div class="comment"><div class="reply">
</div></div>
</div>
</li>
<li class="comment byuser comment-author-chi bypostauthor odd alt thread-odd thread-alt depth-1" id="comment-70">
<div id="div-comment-70" class="comment-body">
<span class="switch-post"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#"><img src="./design-by-contract_files/bullet_toggle_minus(1).png" alt="" class="png"></a></span><div class="comment-author vcard">
<img alt="" src="./design-by-contract_files/fa211026bf1d16166d537ba69b2f6f23.jpeg" class="avatar avatar-32 photo" height="32" width="32"> <cite class="fn">Christina Hirth</cite> <span class="says">sagt:</span> </div>
<div class="comment-meta commentmetadata"><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/comment-page-1/#comment-70">Oktober 26, 2009 um 7:45 pm</a></div>
<div class="comment"><p>Hallo Rainer,</p></div>
<div class="comment"><p>jetzt hast du mich erwischt, das wusste ich tatsächlich nicht!</p></div>
<div class="comment"><div class="reply">
</div></div>
</div>
</li>
<li style="display: none;" class="alt">&nbsp;</li>
</ol>
<div class="navigation">
<div class="alignleft"></div>
<div class="alignright"></div>
</div>
<div id="respond">
<div class="title">Hinterlasse einen Kommentar</div>
<div class="cancel-comment-reply">
<small><a rel="nofollow" id="cancel-comment-reply-link" href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/2009/10/26/design-by-contract-mit-c/#respond" style="display:none;">Click here to cancel reply</a></small>
</div>
<form action="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/wp-comments-post.php" method="post" id="commentform">
<input type="hidden" name="comment_post_ID" value="674" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
<p><input type="text" name="author" id="author" value="" size="22" tabindex="1">
<label for="author"><small>Name (benötigt)</small></label></p>
<p><input type="text" name="email" id="email" value="" size="22" tabindex="2">
<label for="email"><small>E-mail (wird nicht veröffentlicht) (benötigt)</small></label></p>
<p><input type="text" name="url" id="url" value="" size="22" tabindex="3">
<label for="url"><small>Webseite</small></label></p>
<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
<p>
<input name="submit" type="submit" id="submit" tabindex="5" value="Kommentar absenden">
<input type="hidden" name="comment_post_ID" value="674">
</p>
<p style="clear: both;" class="subscribe-to-comments">
<input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;">
<label for="subscribe">Notify me of followup comments via e-mail</label>
</p>
<br class="clear">
</form>
</div>
<script type="text/javascript">
<!-- // <![CDATA[
jQuery(document).ready(function() {
if (jQuery('#trackbacklist li').length == 1)
jQuery('#trackbacks, #trackbacklist').hide();
jQuery('li.comment>div>*').filter(':not(.comment-author, .comment-meta)').wrap('<div class="comment"><\/div>');
jQuery('.comment-author').before('<span class="switch-post"><a href="#"><img src="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/wp-content/themes/mandigo/images/icons/bullet_toggle_minus.png" alt="" class="png" /><\/a><\/span>');
});
// ]]> -->
</script>
</td>
<script src="./design-by-contract_files/Loader_37820.js.Download" type="text/javascript"></script></tr>
</tbody></table>
</div>
<div id="footer" class="png">
<p>
Unterstützt von <a href="https://web.archive.org/web/20100412202601/http://wordpress.org/">WordPress</a>, <a href="https://web.archive.org/web/20100412202601/http://www.onehertz.com/portfolio/wordpress/" target="_blank" title="WordPress themes">Mandigo theme</a> by tom.
<br><a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/feed/"><img src="./design-by-contract_files/rss_s.gif" alt=""> Einträge (RSS)</a>
und <a href="https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/comments/feed/"><img src="./design-by-contract_files/rss_s.gif" alt=""> Kommentare (RSS)</a>.
</p>
</div>
</div>
<script type="text/javascript">
<!-- // <![CDATA[
jQuery(document).ready(function() {
jQuery('#rssicon, #searchsubmit').hover(
function() { this.src = this.src.replace('.gif','_hover.gif'); },
function() { this.src = this.src.replace('_hover.gif','.gif'); }
);
jQuery('.entry img[align=left]' ).addClass('alignleft' );
jQuery('.entry img[align=right]').addClass('alignright');
if (jQuery.browser.msie) {
if (/^[56]/.test(jQuery.browser.version)) {
jQuery.ifixpng('https://web.archive.org/web/20100412202601/http://blog.aztec-project.org/wp-content/themes/mandigo/images/1x1.gif');
jQuery('body, .png').ifixpng();
jQuery('.commentlist.pre27 .avatar').height(36);
}
}
jQuery('p:has(.dropcap)').append('<br class="clear"/>');
togglePost = function(id) {
if (!id) return;
icon = jQuery('#switch-post-'+ id +' img');
icon.attr('src', /minus/.test(icon.attr('src')) ? icon.attr('src').replace('minus', 'plus') : icon.attr('src').replace('plus', 'minus'));
jQuery('#post-'+ id +' .entry').animate({ height: 'toggle', opacity: 'toggle' }, 1000);
}
jQuery('.switch-post img').bind('click', function() {
id = jQuery(this).parents('li').attr('id').replace(/[^\d]+-/, '');
icon = jQuery('#comment-'+ id +' .switch-post img');
src = icon.attr('src');
icon.attr('src', /minus/.test(src) ? src.replace('minus', 'plus') : src.replace('plus', 'minus'));
jQuery('#comment-'+ id +' div.comment').animate({ height: 'toggle', opacity: 'toggle' }, 1000);
return false;
});
toggleSidebars = function() {
icon = jQuery('.switch-sidebars img');
icon.attr('src', /hide/.test(icon.attr('src')) ? icon.attr('src').replace('hide', 'show') : icon.attr('src').replace('show', 'hide'));
jQuery('.sidebars').animate({ width: 'toggle', height: 'toggle', padding: 'toggle', border: 'toggle' }, 1000);
}
jQuery('.widgettitle, .linkcat *:first, .wpg2blockwidget h3').click(function() {
jQuery(this).siblings().animate({ height: 'toggle', opacity: 'toggle' }, 1000);
}).css({cursor: 'n-resize'});
jQuery.each(['tl','tr','bl','br'],function() {
jQuery('#blogname').after('<span class="blogname text-stroke-'+ this +'">'+ jQuery('#blogname a').html() +'<\/span>');
jQuery('#blogdesc').after('<span class="blogdesc text-stroke-'+ this +'">'+ jQuery('#blogdesc' ).html() +'<\/span>');
});
jQuery('#header .page_item:has(ul)').addClass('has_sub, png');
jQuery('#header .page_item').hover(
function() {
ul = jQuery(this).find('>ul');
if (ul.hasClass('sliding')) return;
a = jQuery(this).find('>a');
if (jQuery(this).parent().hasClass('pages')) {
y = a.position().top + a.height();
x = a.position().left + a.width() - ul.width();
}
else {
y = jQuery(this).position().top - 5;
x = jQuery(this).parent().width();
}
jQuery(this)
.find('>ul')
.css({left:x, top:y})
.addClass('sliding')
.slideDown(300, function() { jQuery(this).removeClass('sliding'); });
},
function() {
jQuery(this)
.find('>ul')
.addClass('sliding')
.slideUp(800, function() { jQuery(this).removeClass('sliding').hide(); });
}
);
jQuery('.commentlist li:even').addClass('alt');
});
// ]]> -->
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://web.archive.org/web/20100412202601/https://ssl." : "https://web.archive.org/web/20100412202601/http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="./design-by-contract_files/ga.js.Download" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9511047-1"); pageTracker._trackPageview(); } catch(err) {}</script>
<div data-lastpass-root="" style="position: absolute !important; top: 0px !important; left: 0px !important; height: 0px !important; width: 0px !important;"><template shadowrootmode="closed"><div style="position: absolute; height: 100vh; width: 100vw; z-index: 2147483647; border-radius: 4px; top: 0px; left: 0px; max-height: 0px; max-width: 280px; min-width: auto;"><iframe data-lastpass-infield="true" allow="clipboard-write" src="chrome-extension://hdokiejnpimakedhajhdlcegeplioahd/webclient-infield.html" style="border: none; height: 100%; width: 100%;"></iframe></div></template></div></body></html>