<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Che</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Che"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Che"/>
	<updated>2026-05-21T17:38:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55344</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55344"/>
		<updated>2011-11-17T01:55:45Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
It would not be wrong to say that no software in the world is bug free. A lot of bugs in software can be attributed to the programming errors that the programmers commonly make. The most common of them are: [http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html (4)]&lt;br /&gt;
&lt;br /&gt;
*While considering possibilities, the programmer misses out on some&lt;br /&gt;
*Cut-and-paste programming&lt;br /&gt;
*Inflexible code that cannot adapt to changes that maybe needed of it in future&lt;br /&gt;
*Lack of error checking&lt;br /&gt;
*Software reuse&lt;br /&gt;
*Lack of mechanisms to recover from errors in a graceful manner&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
One of the several things essential in making bug free software a reality is &amp;quot;Programming by contract&amp;quot;. It helps programmers develop robust software.&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of the [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier (callee) and the consumer (caller/client).&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before entering a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] must be satisfied by the consumer of the routine. Each routine ends with a [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object are represented by the class. In other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
If the consumer tries to call the method without meeting the preconditions, it can result in unexpected behavior. The program could crash or run in a loop forever. It may also deceptively generate garbage, while giving an impression that it is running correctly.&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example that shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initializes the supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvariant(); //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before calling the supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
When programming by contract is used with inheritance, a subcontract is added to the subclass. According to this subcontract and in accordance with the Liskov Substitution Principle [http://www.objectmentor.com/resources/articles/lsp.pdf (5)], an overridden method in the subclass may have preconditions that are as weak as or weaker than the preconditions of the base class, and postconditions that are as strong as or stronger than the postconditions of the base class. We can see this in the following example:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class A&lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(1&amp;lt;x&amp;lt;3); // pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;15); //post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class B extends A &lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(0&amp;lt;x&amp;lt;5); //weakened pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;3); //strengthened post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }	&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exception Handling===&lt;br /&gt;
When it is necessary to impose restrictions on the input given to a method, rather than just stating preconditions in the documentation, exception handling can be used. If the input, say an argument to the method is illegal, then an exception an be thrown. This way, the program will work for all inputs. This practice of defending against illegal input is referred to as [http://en.wikipedia.org/wiki/Defensive_programming &amp;quot;Defensive Programming&amp;quot;]. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The exception handling mechanism helps the user catch errors and handle them appropriately. It also makes sense to use it because the likelihood of errors occurring and illegal input being given to methods is very high. However, the downside to this is that throwing an exception can be very expensive. Let us consider the following example:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Search&lt;br /&gt;
{&lt;br /&gt;
    public void BinarySearch(int arr[],int item)&lt;br /&gt;
    {         &lt;br /&gt;
        Precondition: none&lt;br /&gt;
        Postcondition: returns the position of the element to be searched if found, else returns -1&lt;br /&gt;
                       If arr[] is not sorted, an IllegalArgumentException is thrown&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static void main(String args[]) &lt;br /&gt;
    {&lt;br /&gt;
        Search s = new Search();&lt;br /&gt;
        //define an array in which to find an item&lt;br /&gt;
        s.BinarySearch(arr,item); //the method internally handles all inputs&lt;br /&gt;
    }  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
Design by contract helps programmers identify the consistency conditions that are necessary to the proper functioning of each client-supplier contract, and specify, for each one of the conditions, whose responsibility it is to enforce it.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
4. [http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html Common Programming Errors]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
5. [http://www.objectmentor.com/resources/articles/lsp.pdf Liskov Substitution Principle]&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55185</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55185"/>
		<updated>2011-11-16T15:59:57Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Exception Handling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
It would not be wrong to say that no software in the world is bug free. A lot of bugs in software can be attributed to the programming errors that the programmers commonly make. The most common of them are: [http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html (4)]&lt;br /&gt;
&lt;br /&gt;
*While considering possibilities, the programmer misses out on some&lt;br /&gt;
*Cut-and-paste programming&lt;br /&gt;
*Inflexible code that cannot adapt to changes that maybe needed of it in future&lt;br /&gt;
*Lack of error checking&lt;br /&gt;
*Software reuse&lt;br /&gt;
*Lack of mechanisms to recover from errors in a graceful manner&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
One of the several things essential in making bug free software a reality is &amp;quot;Programming by contract&amp;quot;. It helps programmers develop robust software.&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of the [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier (callee) and the consumer (caller/client).&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before entering a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] must be satisfied by the consumer of the routine. Each routine ends with a [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object are represented by the class. In other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
If the consumer tries to call the method without meeting the preconditions, it can result in unexpected behavior. The program could crash or run in a loop forever. It may also deceptively generate garbage, while giving an impression that it is running correctly.&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example that shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initializes the supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvariant(); //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before calling the supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
When programming by contract is used with inheritance, a subcontract is added to the subclass. According to this subcontract and in accordance with the Liskov Substitution Principle [http://www.objectmentor.com/resources/articles/lsp.pdf (5)], an overridden method in the subclass may have preconditions that are as weak as or weaker than the preconditions of the base class, and postconditions that are as strong as or stronger than the postconditions of the base class. We can see this in the following example:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class A&lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(1&amp;lt;x&amp;lt;3); // pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;15); //post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class B extends A &lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(0&amp;lt;x&amp;lt;5); //weakened pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;3); //strengthened post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }	&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exception Handling===&lt;br /&gt;
When it is necessary to impose restrictions on the input given to a method, rather than just stating preconditions in the documentation, exception handling can be used. If the input, say an argument to the method is illegal, then an exception an be thrown. This way, the program will work for all inputs. This practice of defending against illegal input is referred to as [http://en.wikipedia.org/wiki/Defensive_programming &amp;quot;Defensive Programming&amp;quot;]. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The exception handling mechanism helps the user catch errors and handle them appropriately. It also makes sense to use it because the likelihood of errors occurring and illegal input being given to methods is very high. However, the downside to this is that throwing an exception can be very expensive. Let us consider the following example:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Search&lt;br /&gt;
{&lt;br /&gt;
    public void BinarySearch(int arr[],int item)&lt;br /&gt;
    {         &lt;br /&gt;
        Precondition: none&lt;br /&gt;
        Postcondition: returns the position of the element to be searched if found, else returns -1&lt;br /&gt;
                       If arr[] is not sorted, an IllegalArgumentException is thrown&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static void main(String args[]) &lt;br /&gt;
    {&lt;br /&gt;
        Search s = new Search();&lt;br /&gt;
        //define an array in which to find an item&lt;br /&gt;
        s.BinarySearch(arr,item); //the method internally handles all inputs&lt;br /&gt;
    }  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
4. [http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html Common Programming Errors]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
5. [http://www.objectmentor.com/resources/articles/lsp.pdf Liskov Substitution Principle]&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55098</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55098"/>
		<updated>2011-11-16T02:11:36Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Inheritance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier (callee) and the consumer (caller/client).&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before entering a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] must be satisfied by the consumer of the routine. Each routine ends with a [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object are represented by the class. In other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example that shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initializes the supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvariant(); //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before calling the supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
When programming by contract used with inheritance, a subcontracting is added to the inherited class. &lt;br /&gt;
The subcontracting may keep or weaken the precondition; it may keep or strengthen the postcondition.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class A&lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(1&amp;lt;x&amp;lt;3); // pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;15); //post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class B extends A &lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(0&amp;lt;x&amp;lt;5); //weakened pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;3); //strengthened post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }	&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exception Handling===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55097</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55097"/>
		<updated>2011-11-16T02:11:03Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Inheritance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier (callee) and the consumer (caller/client).&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before entering a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] must be satisfied by the consumer of the routine. Each routine ends with a [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object are represented by the class. In other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example that shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initializes the supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvariant(); //verify class invariant&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before calling the supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
When programming by contract used with inheritance, a subcontracting is used in the inherited class. &lt;br /&gt;
The subcontracting may keep or weaken the precondition; it may keep or strengthen the postcondition.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class A&lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(1&amp;lt;x&amp;lt;3); // pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;15); //post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class B extends A &lt;br /&gt;
{&lt;br /&gt;
    public int foo(int x)&lt;br /&gt;
    {&lt;br /&gt;
         assert(0&amp;lt;x&amp;lt;5); //weakened pre-condition&lt;br /&gt;
         ...&lt;br /&gt;
         assert(result&amp;lt;3); //strengthened post-condition&lt;br /&gt;
         return result;&lt;br /&gt;
    }	&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exception Handling===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55087</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55087"/>
		<updated>2011-11-15T21:42:47Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
&lt;br /&gt;
===Exception Handling===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55086</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55086"/>
		<updated>2011-11-15T21:42:23Z</updated>

		<summary type="html">&lt;p&gt;Che: /* How does it work with inheritance? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
===Inheritance===&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55085</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55085"/>
		<updated>2011-11-15T21:41:59Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Benifit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Apply Programming by Contract to Applications==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55077</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55077"/>
		<updated>2011-11-15T21:21:12Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Obligations and Benefits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Design by Contract Metaphor===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55076</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55076"/>
		<updated>2011-11-15T21:20:02Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Obligations and Benefits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Obligations and Benefits===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We can use the previous Java example to show the relationship between obligation and benefit.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55075</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55075"/>
		<updated>2011-11-15T21:18:42Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Obligations and Benefits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Obligations and Benefits===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition() is satisfied by client_method&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55073</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55073"/>
		<updated>2011-11-15T21:18:06Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Obligations and Benefits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Obligations and Benefits===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Obligations&lt;br /&gt;
! Benefit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Client&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy preCondition() &lt;br /&gt;
| Result from supplier_method&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;b&amp;gt;Supplier&amp;lt;/b&amp;gt;&lt;br /&gt;
| Satisfy postCondition()&lt;br /&gt;
| Know that preCondition is satisfied&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55070</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55070"/>
		<updated>2011-11-15T20:05:33Z</updated>

		<summary type="html">&lt;p&gt;Che: /* A Java Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks can be placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Obligations and Benefits===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55069</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55069"/>
		<updated>2011-11-15T20:05:08Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===A Java Example===&lt;br /&gt;
Here is a Java example shows where the checks are placed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Supplier{  //the supplier class&lt;br /&gt;
  public Supplier()&lt;br /&gt;
  {&lt;br /&gt;
      //some code that initialize supplier constructor&lt;br /&gt;
      checkInvariant();  //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
  public supplier_method(Data data)&lt;br /&gt;
  {&lt;br /&gt;
     //some actions performed by supplier method&lt;br /&gt;
     postCondition(); //check if we have done what has been promised&lt;br /&gt;
     checkInvarient(); //verify class invarient&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Client { // the client class&lt;br /&gt;
  public client_method (Data data){ //client method, calls supplier method&lt;br /&gt;
     Supplier s = new Supplier(); //initialize supplier constructor    &lt;br /&gt;
     preCondition(data);  //verify the preCondition before enter supplier method&lt;br /&gt;
     s.supplier_method(data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Obligations and Benefits===&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55066</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55066"/>
		<updated>2011-11-15T19:52:47Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an [http://en.wikipedia.org/wiki/Class_invariant invariant] which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55063</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55063"/>
		<updated>2011-11-15T19:39:19Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Programming by contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55062</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55062"/>
		<updated>2011-11-15T19:39:06Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55061</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55061"/>
		<updated>2011-11-15T19:38:53Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process.&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding].&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling].&lt;br /&gt;
* The connection with automatic software documentation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55060</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55060"/>
		<updated>2011-11-15T19:36:36Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55059</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55059"/>
		<updated>2011-11-15T19:34:34Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Programming by contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract (DbC)] has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55058</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55058"/>
		<updated>2011-11-15T19:33:45Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55057</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55057"/>
		<updated>2011-11-15T19:33:35Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. [http://www.eiffel.com/developers/design_by_contract.html Eiffel Software, Design by Contract]&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55056</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55056"/>
		<updated>2011-11-15T19:32:10Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
DbC is a metaphor on how elements of a software system collaborate with each other, on the basis of mutual obligations and benefits. The metaphor comes from business life, where a &amp;quot;client&amp;quot; and a &amp;quot;supplier&amp;quot; agree on a &amp;quot;contract&amp;quot; which documents that:&lt;br /&gt;
* The supplier must provide a certain product (obligation) and is entitled to expect that the client has paid its fee (benefit). &lt;br /&gt;
* The client must pay the fee (obligation) and is entitled to get the product (benefit). &lt;br /&gt;
* Both parties must satisfy certain obligations, such as laws and regulations, applying to all contracts. [http://www.eiffel.com/developers/design_by_contract.html (3)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55054</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55054"/>
		<updated>2011-11-15T19:29:57Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Programming by contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55053</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55053"/>
		<updated>2011-11-15T19:29:41Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Programming by contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&amp;lt;br&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55052</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55052"/>
		<updated>2011-11-15T19:28:57Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55051</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55051"/>
		<updated>2011-11-15T19:28:36Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Programming by contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55050</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55050"/>
		<updated>2011-11-15T19:28:25Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55049</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55049"/>
		<updated>2011-11-15T19:27:07Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by Contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55048</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55048"/>
		<updated>2011-11-15T19:25:46Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 dynamic binding]&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Exception_%28computer_science%29 exception handling]&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55047</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55047"/>
		<updated>2011-11-15T19:23:42Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance], in particular a formalism for redefinition and dynamic binding&lt;br /&gt;
* The application to exception handling&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55046</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55046"/>
		<updated>2011-11-15T19:21:18Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
* A clear metaphor to guide the design process&lt;br /&gt;
* The application to inheritance, in particular a formalism for redefinition and dynamic binding&lt;br /&gt;
* The application to exception handling&lt;br /&gt;
* The connection with automatic software documentation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55045</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55045"/>
		<updated>2011-11-15T19:19:14Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in DbC support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55044</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55044"/>
		<updated>2011-11-15T19:18:20Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History and Background==&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Programming by Contract or Design by Contract (DbC) has its roots in work on [http://en.wikipedia.org/wiki/Formal_verification formal verification], [http://en.wikipedia.org/wiki/Formal_specification, formal specification] and [http://en.wikipedia.org/wiki/Hoare_logic Hoare logic]. The original contributions includes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55039</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55039"/>
		<updated>2011-11-15T19:08:57Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55034</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55034"/>
		<updated>2011-11-15T18:40:29Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses [http://en.wikipedia.org/wiki/Precondition pre-conditions] and [http://en.wikipedia.org/wiki/Postcondition post-conditions] to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55033</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55033"/>
		<updated>2011-11-15T18:39:40Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a [http://en.wikipedia.org/wiki/Precondition pre-condition] that must be satisfied by the consumer of the routine. Each routine ends with [http://en.wikipedia.org/wiki/Postcondition post-conditions] which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55032</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55032"/>
		<updated>2011-11-15T18:36:36Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a pre-condition that must be satisfied by the consumer of the routine. Each routine ends with post-conditions which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55031</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55031"/>
		<updated>2011-11-15T18:36:22Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a pre-condition that must be satisfied by the consumer of the routine. Each routine ends with post-conditions which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.cs.unc.edu/~stotts/204/contract.html University of North Carolina]&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55030</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55030"/>
		<updated>2011-11-15T18:34:20Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a pre-condition that must be satisfied by the consumer of the routine. Each routine ends with post-conditions which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state. [http://www.cs.unc.edu/~stotts/204/contract.html (2)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55029</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55029"/>
		<updated>2011-11-15T18:31:36Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Methodology== &lt;br /&gt;
Programming by contract creates a contract between the software developer and software user - in Meyer's terms the supplier and the consumer. &lt;br /&gt;
Before enters a method or routine, a pre-condition that must be satisfied by the consumer of the routine. Each routine ends with post-conditions which the supplier guarantees to be true (if and only if the preconditions were met). Also, each class has an invariant which must be satisfied after any changes to an object represented by the class. In the other words, the invariant guarantees the object is in a valid state.&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55028</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55028"/>
		<updated>2011-11-15T17:59:19Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
1. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55027</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55027"/>
		<updated>2011-11-15T17:58:56Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract (1)]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55026</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55026"/>
		<updated>2011-11-15T17:58:31Z</updated>

		<summary type="html">&lt;p&gt;Che: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract 1]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55024</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=55024"/>
		<updated>2011-11-15T17:57:18Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The paradigm was first introduced by [http://c2.com/cgi/wiki?BertrandMeyer Bertrand Meyer], the creator of [http://c2.com/cgi/wiki?EiffelLanguage Eiffel programming language]. Although Eiffel has implemented assertions as built in programming by contract support, the concepts can be applied in any language. It uses pre-conditions and post-conditions to document or programmatically assert the change in state caused by a piece of a program. [http://c2.com/cgi/wiki?DesignByContract Cunningham &amp;amp; Cunningham, Inc., Design by Contract]&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54827</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54827"/>
		<updated>2011-11-11T02:36:22Z</updated>

		<summary type="html">&lt;p&gt;Che: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54826</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54826"/>
		<updated>2011-11-11T02:36:03Z</updated>

		<summary type="html">&lt;p&gt;Che: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
http://www.cs.unc.edu/~stotts/204/contract.html&lt;br /&gt;
http://www.cs.usfca.edu/~parrt/course/601/lectures/programming.by.contract.html&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54825</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54825"/>
		<updated>2011-11-11T02:32:08Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Benifit= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
&lt;br /&gt;
==Benifit==&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54824</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54824"/>
		<updated>2011-11-11T02:31:45Z</updated>

		<summary type="html">&lt;p&gt;Che: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Common programming errors=&lt;br /&gt;
&lt;br /&gt;
=Programming by contract=&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
&lt;br /&gt;
==Benifit===&lt;br /&gt;
&lt;br /&gt;
==How does it work with inheritance?==&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1===&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
===Example 3===&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54771</id>
		<title>CSC/ECE 517 Fall 2011/ch18 6a sc</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch18_6a_sc&amp;diff=54771"/>
		<updated>2011-11-08T23:39:04Z</updated>

		<summary type="html">&lt;p&gt;Che: Created page with &amp;quot;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;  __TOC__  =What is Programming by Contract= =Section 1= ==Example== =Section 2= ==Example== =Summary= =References=&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;'''Programming by Contract'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=What is Programming by Contract=&lt;br /&gt;
=Section 1=&lt;br /&gt;
==Example==&lt;br /&gt;
=Section 2=&lt;br /&gt;
==Example==&lt;br /&gt;
=Summary=&lt;br /&gt;
=References=&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch2_2c_ac&amp;diff=51506</id>
		<title>CSC/ECE 517 Fall 2011/ch2 2c ac</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch2_2c_ac&amp;diff=51506"/>
		<updated>2011-09-30T05:11:40Z</updated>

		<summary type="html">&lt;p&gt;Che: /* Comparing Ruby mixins to Java interfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
=Ruby mixins versus Java interfaces=&lt;br /&gt;
&lt;br /&gt;
To inherit from multiple sources Ruby uses mixins while Java uses interfaces.&lt;br /&gt;
This article explains both mechanisms, finds similarities and highlights differences between the two.&lt;br /&gt;
Some code samples show the practical use of both mechanisms.&lt;br /&gt;
The article also tries to remark situations where the use of one mechanism would be more appropriate than the other.&lt;br /&gt;
&lt;br /&gt;
= Ruby [http://en.wikipedia.org/wiki/Mixin mixins] =&lt;br /&gt;
In Ruby a mixin happens when a &amp;lt;tt&amp;gt;module&amp;lt;/tt&amp;gt; is included/mixed into a class or into another module.&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;module&amp;lt;/tt&amp;gt; is &amp;quot;a way of grouping together&amp;quot; different elements like class/instance methods, classes, instance variables and constants.(Thomas [3] page 76)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# module Introspect defines a method named 'kind'&lt;br /&gt;
module Introspect&lt;br /&gt;
  def kind&lt;br /&gt;
    puts &amp;quot;#{self.class.name}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A module cannot be instantiated but it can be included/mixed into another class&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The Animal and the Car classes include/mix in the module Introspect&lt;br /&gt;
class Animal&lt;br /&gt;
  include Introspect&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Car&lt;br /&gt;
  include Introspect&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The class that includes a module inherits anything that the module defines.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
d = Animal.new&lt;br /&gt;
c = Car.new&lt;br /&gt;
&lt;br /&gt;
# the method 'kind' is inherited from the Introspect module&lt;br /&gt;
puts d.kind&lt;br /&gt;
puts c.kind&lt;br /&gt;
&lt;br /&gt;
# outputs&lt;br /&gt;
Animal&lt;br /&gt;
Car&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the code in the module has access to variables of the host class. In this sample the ''kind'' method defined in the ''Introspect'' module accesses the &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; variable of the host class (either ''Animal'' or ''Car'').&lt;br /&gt;
&lt;br /&gt;
=Java [http://download.oracle.com/javase/tutorial/java/concepts/interface.html interfaces]=&lt;br /&gt;
In its most common form, an interface is a group of related methods with empty bodies.&lt;br /&gt;
A bicycle's behavior, if specified as an interface, might appear as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Bicycle {&lt;br /&gt;
&lt;br /&gt;
       void changeGear(int newValue);&lt;br /&gt;
&lt;br /&gt;
       void speedUp(int increment);&lt;br /&gt;
&lt;br /&gt;
       void applyBrakes(int decrement);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To implement this interface, the name of your class would change (to a particular brand of bicycle, for example, such as ACMEBicycle), and you'd use the &amp;lt;tt&amp;gt;implements&amp;lt;/tt&amp;gt; keyword in the class declaration:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class ACMEBicycle implements Bicycle {&lt;br /&gt;
&lt;br /&gt;
    void changeGear(int newValue){&lt;br /&gt;
    	// method implementation&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void speedUp(int increment){&lt;br /&gt;
    	// method implementation&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void applyBrakes(int decrement){&lt;br /&gt;
    	// method implementation&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comparing Ruby mixins to Java interfaces=&lt;br /&gt;
These two diagrams from [http://www.slideshare.net/mbowler/ruby-for-java-programmers Ruby For Java Programmers] illustrates how inheritance is done by Ruby mixins and Java interfaces.&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Ruby Mixins &lt;br /&gt;
!Java Interfaces &lt;br /&gt;
|-&lt;br /&gt;
|[[File:rubymixin.png|200px]]&lt;br /&gt;
|[[File:javainheritance.png|300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Now let's look at some of the differences and similarities between Ruby mixins and Java interfaces.&lt;br /&gt;
==Implementation Inheritance==&lt;br /&gt;
In Ruby, a class that includes a module inherits the implementation of the methods defined in the module as well as the instance variables defined in the module.&lt;br /&gt;
&lt;br /&gt;
In Java, a class that implements an interface inherits the signatures of the methods defined in the interface but it must provide with the implementation of the methods itself.&lt;br /&gt;
&lt;br /&gt;
In the Ruby sample the host class inherits from the ''Introspect'' module the implementation of the ''kind'' method and therefore it can call the method right away.&lt;br /&gt;
&lt;br /&gt;
The ability to call the inherited methods right away is good for rapid prototyping, but in Ruby, one should be aware that the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; “statement makes a reference to a module. If multiple classes include that module they’ll all point to the same thing. If you change the definition of a method within that module, even while your program is running, all classes that include the module will exhibit the new behavior.” (Thomas [3] page 79)&lt;br /&gt;
&lt;br /&gt;
Bloch reminds us that this is one of the risks of ''implementation inheritance'': for its proper function, the host class may depend on the implementation of the included module. If the implementation of the included module changes the host class may brake. (Bloch [1] page 81)&lt;br /&gt;
&lt;br /&gt;
Another risk associated to ''implementation inheritance'' in Ruby is that &amp;quot;mixed-in module's instance variables can clash with the ones of the host class or with the ones of other mixins.&amp;quot;(Thomas [3] page 82)&lt;br /&gt;
&lt;br /&gt;
For example the following module adds the instance variable ''@observer_list''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module Observable&lt;br /&gt;
  def observers&lt;br /&gt;
    @observer_list ||= []&lt;br /&gt;
  end&lt;br /&gt;
  def add_observer(obj)&lt;br /&gt;
    observer &amp;lt;&amp;lt; obj&lt;br /&gt;
  end&lt;br /&gt;
  def notify_observers&lt;br /&gt;
    observers.each {|o| o.update}&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but a class that includes the module could also use an instance variable named ''@observer_list''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class TelescopeScheduler&lt;br /&gt;
  # other classes can register to get notifications when the schedule changes&lt;br /&gt;
  include Observable&lt;br /&gt;
  def initialize&lt;br /&gt;
    @observer_list = []  # people with telescope time&lt;br /&gt;
  end&lt;br /&gt;
  def add_viewer(viewer)&lt;br /&gt;
    @observer_list &amp;lt;&amp;lt; viewer&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If this happens, Thomas states that, at runtime, the TelescopeScheduler could malfunction in ways difficult to diagnose. (Thomas [3] page 82)&lt;br /&gt;
&lt;br /&gt;
With Java interfaces this problem cannot happen because there's no implementation inheritance: Any field you declare in an interface is automatically public static and final, in other words a constant and not an instance variable that can be inherited.&lt;br /&gt;
&lt;br /&gt;
==Separation of interface and implementation==&lt;br /&gt;
Java interfaces ensure the separation of interface and implementation by requiring the implementing classes to implement all the methods inherited from the interfaces.&lt;br /&gt;
Ruby does not enforce this separation in mixins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example we have a &amp;lt;tt&amp;gt;Shape&amp;lt;/tt&amp;gt; interface, and a &amp;lt;tt&amp;gt;Circle&amp;lt;/tt&amp;gt; class that implements &amp;lt;tt&amp;gt;Shape&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package interfaces;&lt;br /&gt;
&lt;br /&gt;
public interface Shape {&lt;br /&gt;
	public void draw();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package classes;&lt;br /&gt;
&lt;br /&gt;
import interfaces.Shape;&lt;br /&gt;
&lt;br /&gt;
public class Circle implements Shape{&lt;br /&gt;
	public void draw()&lt;br /&gt;
	{&lt;br /&gt;
		System.out.println(&amp;quot;This method draws a circle&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the Circle class does not provide a &amp;lt;tt&amp;gt;draw&amp;lt;/tt&amp;gt; method, the class will not compile.&lt;br /&gt;
&lt;br /&gt;
However, in Ruby, an interface can be simulated but a class does not require to override the inherited methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module Shape&lt;br /&gt;
	def draw&lt;br /&gt;
		raise NoMethodError, &amp;quot;draw method is not defined for Shape&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Circle&lt;br /&gt;
	include Shape&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts Circle.new.draw&lt;br /&gt;
&lt;br /&gt;
=&amp;gt;shape.rb:3:in `draw': draw method is not defined for Shape (NoMethodError)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Method name collision handling==&lt;br /&gt;
Method names collisions in Java interfaces are eliminated at compile time.&lt;br /&gt;
&lt;br /&gt;
Because of the unbound polymorphism nature, the return type of Ruby method is determined at run time. This allows a class inherits from two modules that include same method call with different return types.&lt;br /&gt;
&lt;br /&gt;
In Java, a class cannot inherit from two interfaces that include same method with different return type, due to the name conflict. &lt;br /&gt;
For example,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface I1 {&lt;br /&gt;
	public void method1();&lt;br /&gt;
}&lt;br /&gt;
public interface I2 {&lt;br /&gt;
	public int method1();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package classes;&lt;br /&gt;
import interfaces.I1;&lt;br /&gt;
import interfaces.I2;&lt;br /&gt;
&lt;br /&gt;
public class Mul_inherit implements I1, I2{&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Mul_inherit class will give error since there are no ways to satisfy both method1 signatures from I1 and I2.&lt;br /&gt;
&lt;br /&gt;
But with Mixin this example is allowed since&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
1. A method always returns a value (nil if nothing is defined).&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
2. The type of return object is determined at runtime.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module M1&lt;br /&gt;
    def method1&lt;br /&gt;
	#this method returns nothing&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
module M2&lt;br /&gt;
    def method1&lt;br /&gt;
        &amp;quot;returns a string&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
include M1&lt;br /&gt;
include M2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts Myclass.new.method1&lt;br /&gt;
&lt;br /&gt;
=&amp;gt;returns a string&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby the latest method definition always overloads the previous one, therefore, the name collision needs to be handled more carefully.&lt;br /&gt;
&lt;br /&gt;
To avoid name clashes at the origin each module could prefix the name of a method with the name of the module so that the two modules in the previous example could become&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module M1&lt;br /&gt;
    def M1method1&lt;br /&gt;
	    &amp;quot;this is M1method1&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
module M2&lt;br /&gt;
    def M2method1&lt;br /&gt;
        &amp;quot;this is M2method1&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
include M1&lt;br /&gt;
include M2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts Myclass.new.M1method1&lt;br /&gt;
puts Myclass.new.M2method1&lt;br /&gt;
&lt;br /&gt;
=&amp;gt;this is M1method1&lt;br /&gt;
=&amp;gt;this is M2method1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Ruby mixins vs. Java interfaces feature comparison ==&lt;br /&gt;
Now lets look at some features Ruby mixin provides and compare it with Java interface.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Features&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Ruby Mixins &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Java Interfaces&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Add functionality/behavior to a class&lt;br /&gt;
| Yes. When a Ruby module gets mixed in a Ruby class, the class receives the implementation (behavior) of the methods defined in the module. || No. A Java interface &amp;quot;can contain only constants, method signatures, and nested types. There are no method bodies. Interfaces cannot be instantiated—they can only be implemented by classes or extended by other interfaces.&amp;quot; (Java Interface)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Favor composition over inheritance&lt;br /&gt;
| Yes. The class that includes a module establishes a &amp;quot;use-a&amp;quot; relationship with the module. This is composition. || No. The class that implements an interface establishes a &amp;quot;is-a&amp;quot; relationship with the interface. This is inheritance.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | The code of the mixin/interface interacts with the code of the class that includes/implements it&lt;br /&gt;
| Yes. A mixed-in module can implement methods in terms of the host's class methods. See the Enumerable example.|| No. An interface provides a set of method signatures that the host class must implement. An interface provides no implementation of methods.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=	Examples=&lt;br /&gt;
We are going to compare mixin and interface implementations by looking at some code examples. &lt;br /&gt;
== Comparable==&lt;br /&gt;
&amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; provides a set of operations that can be used to compare two objects.&lt;br /&gt;
&lt;br /&gt;
===     In Ruby===&lt;br /&gt;
If a Ruby class wants to use &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; functions, it needs to define a method called &amp;lt;=&amp;gt; (sometimes called “rocket”). Ones the rocket function is defined, we get a lot of comparison functions for free, such as &amp;lt;tt&amp;gt;&amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, == &amp;lt;/tt&amp;gt;and the method &amp;lt;tt&amp;gt;between&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose we have a &amp;lt;tt&amp;gt;Rectangle&amp;lt;/tt&amp;gt; class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Rectangle&lt;br /&gt;
    attr_reader :x,:y&lt;br /&gt;
    def initialize(x,y)&lt;br /&gt;
	@x,@y=x,y&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we want to compare the area of two rectangles. We can do so by include the &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; mixin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Rectangle&lt;br /&gt;
include Comparable&lt;br /&gt;
    def area&lt;br /&gt;
	x*y&lt;br /&gt;
    end&lt;br /&gt;
    def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	self.area&amp;lt;=&amp;gt;other.area&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;=&amp;gt; function uses &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; mixin of &amp;lt;tt&amp;gt;Fixnum&amp;lt;/tt&amp;gt; class to compare the area of two rectangles. We can call the &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; methods on &amp;lt;tt&amp;gt;Rectangle&amp;lt;/tt&amp;gt; objects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
r1 = Rectangle.new(3,4)&lt;br /&gt;
r2 = Rectangle.new(4,5)&lt;br /&gt;
puts r1.area&lt;br /&gt;
if r1 &amp;lt; r2&lt;br /&gt;
   puts &amp;quot;The area of Rectangle 1 is smaller than Rectangle 2&amp;quot;&lt;br /&gt;
else if r1 &amp;gt; r2&lt;br /&gt;
   puts &amp;quot;The area of Rectangle 1 is larger than Rectangle 2&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
   puts &amp;quot;The area of Rectangle 1 equals to Rectangle 2&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&amp;gt;12&lt;br /&gt;
=&amp;gt;The area of Rectangle 1 is smaller than Rectangle 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===     In Java===&lt;br /&gt;
Java provides &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; interface. A Java class implements &amp;lt;tt&amp;gt;Comparable&amp;lt;/tt&amp;gt; interface need to define &amp;lt;tt&amp;gt;compareTo&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
For the same &amp;lt;tt&amp;gt;Rectangle&amp;lt;/tt&amp;gt; class example, we need to define &amp;lt;tt&amp;gt;compareTo&amp;lt;/tt&amp;gt; method, and define each of the &amp;lt;tt&amp;gt;&amp;lt;=&amp;gt;&amp;lt;/tt&amp;gt; operators within the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Rectangle implements Comparable {&lt;br /&gt;
&lt;br /&gt;
	private int x,y;&lt;br /&gt;
	&lt;br /&gt;
	public Rectangle(int width, int length)&lt;br /&gt;
	{&lt;br /&gt;
		x=width;&lt;br /&gt;
		y=length;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public int area()&lt;br /&gt;
	{&lt;br /&gt;
		return x*y;&lt;br /&gt;
	}&lt;br /&gt;
	public int compareTo(Object otherRectangle)&lt;br /&gt;
	{&lt;br /&gt;
		/*&lt;br /&gt;
		 * If passed object is of type other than Rectangle, throw ClassCastException&lt;br /&gt;
		 */&lt;br /&gt;
		if(!(otherRectangle instanceof Rectangle)){&lt;br /&gt;
			 throw new ClassCastException(&amp;quot;Invalid object&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
		/*&lt;br /&gt;
		 * If left operand less than right operand return -1&lt;br /&gt;
		 * If left operand greater than right operand return 1&lt;br /&gt;
		 * If left operand equals to right operand return 0&lt;br /&gt;
		 */&lt;br /&gt;
		int otherArea=((Rectangle)otherRectangle).area();&lt;br /&gt;
		if (this.area() &amp;lt; otherArea)&lt;br /&gt;
			return -1;&lt;br /&gt;
		else if (this.area() &amp;gt; otherArea)&lt;br /&gt;
			return 1;&lt;br /&gt;
		else&lt;br /&gt;
			return 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;compareTo&amp;lt;/tt&amp;gt; function is then used on &amp;lt;tt&amp;gt;Rectangle&amp;lt;/tt&amp;gt; object when comparing two Rectangle objects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class CompareRectangle {&lt;br /&gt;
	public void main(String args[]){&lt;br /&gt;
		&lt;br /&gt;
		Rectangle r1=new Rectangle(3,4);		&lt;br /&gt;
		Rectangle r2=new Rectangle(4,5);&lt;br /&gt;
&lt;br /&gt;
		if (r1.compareTo(r2) &amp;lt; 0)&lt;br /&gt;
			System.out.println(&amp;quot;The area of Rectangle 1 is smaller than Rectangle 2&amp;quot;);&lt;br /&gt;
		if (r1.compareTo(r2) &amp;gt; 0)&lt;br /&gt;
			System.out.println(&amp;quot;The area of Rectangle 1 is larger than Rectangle 2&amp;quot;);&lt;br /&gt;
		if (r1.compareTo(r2)==0)&lt;br /&gt;
			System.out.println(&amp;quot;The area of Rectangle 1 equals to Rectangle 2&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Singleton==&lt;br /&gt;
The &amp;lt;tt&amp;gt;Singleton&amp;lt;/tt&amp;gt; design pattern ensures that only one instance of a particular class may be created for the lifetime of a program.&lt;br /&gt;
&lt;br /&gt;
=== In Ruby ===&lt;br /&gt;
The &amp;lt;tt&amp;gt;singleton&amp;lt;/tt&amp;gt; library contains the &amp;lt;tt&amp;gt;Singleton&amp;lt;/tt&amp;gt; module that if mixed into a class will make the class a singleton.&lt;br /&gt;
The &amp;lt;tt&amp;gt;Singleton&amp;lt;/tt&amp;gt; module makes the mixee &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; method private and replaces it with a method called &amp;lt;tt&amp;gt;instance&amp;lt;/tt&amp;gt; that when called returns a singleton instance of the mixee. &lt;br /&gt;
&lt;br /&gt;
You do not have to code the singleton functionality inside each class that needs to be a singleton.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'singleton'&lt;br /&gt;
&lt;br /&gt;
class Klass&lt;br /&gt;
      include Singleton&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
a,b  = Klass.instance, Klass.instance&lt;br /&gt;
=&amp;gt; [#&amp;lt;Klass:0x007fa7a28798e8&amp;gt;, #&amp;lt;Klass:0x007fa7a28798e8&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
a == b&lt;br /&gt;
=&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
Klass.new&lt;br /&gt;
NoMethodError: private method `new' called for Klass:Class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In Java ===&lt;br /&gt;
Each class that needs to be a singleton must implement the singleton functionality itself such as in the following example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Singleton  {&lt;br /&gt;
    private static final Singleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
Private constructor prevents instantiation from other classes&lt;br /&gt;
**/&lt;br /&gt;
    private Singleton() {&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public static Singleton getInstance() {&lt;br /&gt;
        return instance;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==	 Enumerable==&lt;br /&gt;
The &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; pattern is used to describe a set of fix constants. &lt;br /&gt;
===	In Ruby===&lt;br /&gt;
&amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; is a standard mixin in Ruby that can be included in any class. A class wants to use &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; functions need to define &amp;lt;tt&amp;gt;each&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
Consider a class takes a string and change the words to uppercase. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class WordToUpper&lt;br /&gt;
include Enumerable&lt;br /&gt;
    attr_reader :string&lt;br /&gt;
    def initialize(string)&lt;br /&gt;
	@string=string&lt;br /&gt;
    end&lt;br /&gt;
    def each&lt;br /&gt;
	@string.upcase.scan(/\w/) do |upper|&lt;br /&gt;
	  yield upper&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    def to_s&lt;br /&gt;
        self.each{|a| puts a}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that &amp;lt;tt&amp;gt;each&amp;lt;/tt&amp;gt; method is defined we can use &amp;lt;tt&amp;gt;inject&amp;lt;/tt&amp;gt; method from &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; mixin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
puts WordToUpper.new(&amp;quot;Rudolph is a Ring Deer!&amp;quot;).inject{|v,n| v+n}&lt;br /&gt;
&lt;br /&gt;
=&amp;gt;RUDOLPHISARINGDEER&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===	In Java ===&lt;br /&gt;
In Java there is no interface comparable to the &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; mixin in Ruby defined. Java can simulate the use of &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; by using &amp;lt;tt&amp;gt;Iterator&amp;lt;/tt&amp;gt; class. However, it is not as convenient as have a &amp;lt;tt&amp;gt;Enumerable&amp;lt;/tt&amp;gt; interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
&lt;br /&gt;
public class EnumerableExample {&lt;br /&gt;
	public static void main(String args[])&lt;br /&gt;
	{&lt;br /&gt;
	    //removal of items requires an explicit iterator :&lt;br /&gt;
	    Collection&amp;lt;String&amp;gt; words = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
	    words.add(&amp;quot;Rudolph&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;is&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;a&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;red&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;nose&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;ring&amp;quot;);&lt;br /&gt;
	    words.add(&amp;quot;deer&amp;quot;);&lt;br /&gt;
	    for(Iterator&amp;lt;String&amp;gt; iter = words.iterator(); iter.hasNext();){&lt;br /&gt;
	      if (iter.next().length() == 4){&lt;br /&gt;
	        iter.remove();&lt;br /&gt;
	      }&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, we removed all strings with length of 4 in the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== DataMapper ==&lt;br /&gt;
Martin Fowler describes the Data Mapper design pattern as &amp;quot;a layer of software that separates the in-memory objects from the database. Its responsibility is to transfer data between the two and also to isolate them from each other. With Data Mapper the in-memory objects needn't know even that there's a database present; they need no SQL interface code, and certainly no knowledge of the database schema. (The database schema is always ignorant of the objects that use it.)&amp;quot;(Data Mapper)&lt;br /&gt;
&lt;br /&gt;
=== In Ruby ===&lt;br /&gt;
The DataMapper Ruby library was originally developed to address perceived shortcomings in Ruby on Rails' ActiveRecord library. For example DataMapper lets you avoid writing raw query fragments yourself. It allows you to write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Zoo.all(:name =&amp;gt; 'Dallas')&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Zoo.find(:all, :conditions =&amp;gt; [ 'name = ?', 'Dallas' ])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In Java ===&lt;br /&gt;
&lt;br /&gt;
The [http://code.google.com/p/mybatis/ mybatis SQL Mapping Framework] implements the Data Mapper design pattern.&lt;br /&gt;
Its setup and use though seem more complicated than the DataMapper Ruby library.&lt;br /&gt;
&lt;br /&gt;
= Mixins in Java =&lt;br /&gt;
Java does not support mixins natively.&lt;br /&gt;
&lt;br /&gt;
Different approaches try to reproduce the mixin feature in Java.&lt;br /&gt;
&lt;br /&gt;
One example is the [http://cglib.sourceforge.net/ cgilb] Java library.&lt;br /&gt;
It provides the [http://cglib.sourceforge.net/apidocs/index.html Mixin] class that allows multiple objects to be combined into a single larger object at run time. The methods in the generated object simply call the original methods in the underlying &amp;quot;delegate&amp;quot; objects.&lt;br /&gt;
&lt;br /&gt;
A similar result is achieved at compile time by this [http://code.google.com/p/javadude/wiki/AnnotationsMixinExample Java annotations processor]. Let's say for example that you want to combine/mix the functionality of three classes into one class. You can write a Java annotation that declares which classes you want to mix, then you pass this annotation to the annotation processor and you get the source code of a class that combines all the three behaviors.&lt;br /&gt;
&lt;br /&gt;
Another approach is to implement the [http://en.wikipedia.org/wiki/Decorator_pattern Decorator] design pattern. In this case the new behavior is added not statically to classes at compile time but to specific objects/instances at run time.&lt;br /&gt;
=Conclusion=&lt;br /&gt;
In comparison with Java interface, Ruby mixin provides more flexibility and functionality. Ruby mixin can include behavior to a class. It makes mix and match of several classes easy. It also includes many standard mixins such as Singleton, Comparable, Enumerable and Datamapper, these standard modules make these design patterns easy to use and inherit functions by new objects. While Ruby mixin might seem more powerful than Java interface, Java interface still have its advantage over Ruby mixin in some cases. Java interface handles separation of interface and implementation better, it also handles name collision more strictly than Ruby mixin. Furthermore, when Ruby class includes a module, it gets a reference of the module, which increases coupling between the class and the included module. If the included module changes during runtime the class might result in some unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Joshua Bloch, &amp;quot;Effective Java&amp;quot;. Second Edition. May 2008, Prentice Hall.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.slideshare.net/mbowler/ruby-for-java-programmers Ruby For Java Programmers] by Mike Bowler.&lt;br /&gt;
&lt;br /&gt;
3. Dave Thomas, Chad Fowler, Andy Hunt, &amp;quot;Programming Ruby 1.9: The Pragmatic Programmers' Guide (Facets of Ruby Series)&amp;quot;. Third Edition. April 2009, Pragmatic Bookshelf.&lt;br /&gt;
 &lt;br /&gt;
4. [http://download.oracle.com/javase/tutorial/java/IandI/createinterface.html Java Interface] From oracle.com, the Java Tutorials.&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Mixin Mixin] From Wikipedia, the free encyclopedia.&lt;br /&gt;
&lt;br /&gt;
6. [http://martinfowler.com/eaaCatalog/dataMapper.html Data Mapper Design Pattern] From Martin Fowler.&lt;br /&gt;
&lt;br /&gt;
7. [http://datamapper.org/ Data Mapper in Ruby] From DataMapper, Ruby Object Relational Mapper.&lt;br /&gt;
&lt;br /&gt;
8. [http://code.google.com/p/mybatis/ Data Mapper in Java] From mybatis - SQL mapping framwork for Java.&lt;br /&gt;
&lt;br /&gt;
9. [http://cglib.sourceforge.net/ cgilb] From Code Generation Library, [http://cglib.sourceforge.net sourceforge.net].&lt;br /&gt;
&lt;br /&gt;
10. [http://code.google.com/p/javadude/wiki/AnnotationsMixinExample Java annotations processor] From AnnotationsMixinExample, JavaDude OpenSource Projects.&lt;br /&gt;
&lt;br /&gt;
11. [http://en.wikipedia.org/wiki/Decorator_pattern Decorator pattern] From Wikipedia, the free encyclopedia.&lt;/div&gt;</summary>
		<author><name>Che</name></author>
	</entry>
</feed>