<?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=Gohan</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=Gohan"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Gohan"/>
	<updated>2026-06-05T15:16:18Z</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_2009/wiki3_15_SJ3&amp;diff=29449</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29449"/>
		<updated>2009-11-19T03:05:18Z</updated>

		<summary type="html">&lt;p&gt;Gohan: /* Design by Contract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
== Design by Contract ==&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract Benefits === &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
* Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
* Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
* Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
* When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to either client code or provided code)&lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
* If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
* Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
* If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29447</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29447"/>
		<updated>2009-11-19T03:04:48Z</updated>

		<summary type="html">&lt;p&gt;Gohan: /* Assertion Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
* Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
* Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
* Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
* When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to either client code or provided code)&lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
* If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
* Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
* If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29039</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29039"/>
		<updated>2009-11-19T00:50:16Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
* Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
* Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
* Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
* When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to either client code or provide code)&lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
* If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
* Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
* If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29038</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29038"/>
		<updated>2009-11-19T00:49:43Z</updated>

		<summary type="html">&lt;p&gt;Gohan: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
* Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
* Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
* Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
* When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to either client code or provide code)&lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
* If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
* Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
* If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29037</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29037"/>
		<updated>2009-11-19T00:48:49Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
* Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
* Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
* Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
* When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to either client code or provide code)&lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
* If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
* Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
* If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29032</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29032"/>
		<updated>2009-11-19T00:47:54Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
For detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General Assertion Error ===&lt;br /&gt;
Assertion will fail here if there is not any memory to allocate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int* ptr = (int) malloc(sizeof(int));&lt;br /&gt;
assert(ptr != NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assertion Advantages ==&lt;br /&gt;
Since they help clarifiy program constraints and assumptions they help with providing documentation.&lt;br /&gt;
Provide runtime verification, which leads to continious and ongoing testing.&lt;br /&gt;
Can perform Validations deep inside of a private method or in general a method not publicly visible.&lt;br /&gt;
When used inside of classes they are encapuslated and hidden from the client. (helps client isolate problem to code &lt;br /&gt;
&lt;br /&gt;
== Assertion Disadvantages ==&lt;br /&gt;
If not turned off they can lead to serious performance implications (e.g. asserting a list is sorted)&lt;br /&gt;
Not useful when validaton and output for a given input over a range of scenarios&lt;br /&gt;
If assumptons are to restrictive assertions indicate bugs that are potentially false positives.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29003</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29003"/>
		<updated>2009-11-19T00:35:47Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Invariant contract ===&lt;br /&gt;
Here is simple example of invariant condition. Physically a size of a container should be 0 or positive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(size &amp;gt;= 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
== The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29000</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=29000"/>
		<updated>2009-11-19T00:33:01Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort or execute an exception handler.  Typically if program is aborted the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
=== Precondition and Postcondition contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long square_root(long x)&lt;br /&gt;
in&lt;br /&gt;
{&lt;br /&gt;
    assert(x &amp;gt;= 0);&lt;br /&gt;
}&lt;br /&gt;
out (result)&lt;br /&gt;
{&lt;br /&gt;
    assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
}&lt;br /&gt;
body&lt;br /&gt;
{&lt;br /&gt;
    return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28990</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28990"/>
		<updated>2009-11-19T00:30:20Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort.  Typically the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of [http://en.wikipedia.org/wiki/Precondition preconditions], [http://en.wikipedia.org/wiki/Postcondition postconditions], [http://en.wikipedia.org/wiki/Invariant_(computer_science) invariants], and general errors. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module, etc.&lt;br /&gt;
&lt;br /&gt;
==== Design by Contract Benefits ==== &lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28974</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28974"/>
		<updated>2009-11-19T00:26:57Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort.  Typically the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [http://en.wikipedia.org/wiki/Design_by_contract Design by Contract]. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28964</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28964"/>
		<updated>2009-11-19T00:25:16Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort.  Typically the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
=== Design by Contract ===&lt;br /&gt;
Assertions are used in a facility called [Design by Contract], http://en.wikipedia.org/wiki/Design_by_contract. &lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28952</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28952"/>
		<updated>2009-11-19T00:23:05Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The way the assertion statement behaves is based on the expression.  If the expression evaluates to true execution proceeds past the statement without notice.  If the expression evaluates false and exception is thrown causing the program to abort.  Typically the expression and line number are displayed to standard error as well.&lt;br /&gt;
&lt;br /&gt;
Assertions are used in a facility called [Design by Contract]&lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28936</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28936"/>
		<updated>2009-11-19T00:18:46Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
Here is a basic assertion statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28931</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28931"/>
		<updated>2009-11-19T00:17:03Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Programming by Assertion'''&lt;br /&gt;
&lt;br /&gt;
== Introduction to Assertions ==&lt;br /&gt;
Assertions is statement used in code that indicates what a programmer assumes to be true at that point during execution.  They are used to help clarify program constraints and assumptions and ensure program correctness.  In general they can be thought of as way of testing.  Unlike test cases which apply external stimuli to objects and validate their state, assertions checks are used to check assumptions and constraints internally.&lt;br /&gt;
&lt;br /&gt;
The Asset Statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28924</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 SJ3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_SJ3&amp;diff=28924"/>
		<updated>2009-11-19T00:13:37Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Advantages and Disadvantages of Programming by Contract'''&lt;br /&gt;
&lt;br /&gt;
== Introduction of Contract Programming ==&lt;br /&gt;
&lt;br /&gt;
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. These specifications of &amp;quot;contract&amp;quot; define the interface of different element of software includes method, class, module... &lt;br /&gt;
&lt;br /&gt;
===Assert contract===&lt;br /&gt;
The most basic contract is the assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 assert(expression);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
an assert  in function bodies works by throwing an AssertError, which can be caught and handled. Catching the contract violation is useful when the code must deal with errant uses by other code, when it must be failure proof, and as a useful tool for debugging.&lt;br /&gt;
&lt;br /&gt;
===Pre and Post contract ===&lt;br /&gt;
The pre contracts specify the preconditions before a statement is executed. The most typical use of this would be in validating the parameters to a function. The post contracts validate the result of the statement. The most typical use of this would be in validating the return value of a function and of any side effects it has. The syntax is: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  long square_root(long x)&lt;br /&gt;
    in&lt;br /&gt;
    {&lt;br /&gt;
	assert(x &amp;gt;= 0);&lt;br /&gt;
    }&lt;br /&gt;
    out (result)&lt;br /&gt;
    {&lt;br /&gt;
	assert((result * result) &amp;lt;= x &amp;amp;&amp;amp; (result+1) * (result+1) &amp;gt;= x);&lt;br /&gt;
    }&lt;br /&gt;
    body&lt;br /&gt;
    {&lt;br /&gt;
	return cast(long)std.math.sqrt(cast(real)x);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===In, Out and Inheritance ===&lt;br /&gt;
If a function in a derived class overrides a function in its super class, then only one of the in contracts of the function and its base functions must be satisfied. Overriding functions then becomes a process of loosening the in  contracts. &lt;br /&gt;
&lt;br /&gt;
===Class Invariants ===&lt;br /&gt;
Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). They are described in Classes. &lt;br /&gt;
&lt;br /&gt;
for detail information of contract, please refers to the helpful reading list in [2].&lt;br /&gt;
&lt;br /&gt;
==The advantages of Contract Programming==&lt;br /&gt;
&lt;br /&gt;
* A better understanding of the object-oriented method and, more generally, of software construction.&lt;br /&gt;
* A systematic approach to building bug-free object-oriented systems.&lt;br /&gt;
* An effective framework for debugging, testing and, more generally, quality assurance.&lt;br /&gt;
* A method for documenting software components.&lt;br /&gt;
* Better understanding and control of the inheritance mechanism.&lt;br /&gt;
* A technique for dealing with abnormal cases, leading to a safe and effective language construct for exception handling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The disadvantages of Contract Programming ===&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] wiki page of &amp;quot;Design by Contract&amp;quot;, http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
[2] reading list of contract, http://www.eecs.northwestern.edu/~robby/contract-reading-list/&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a_9b_SJ&amp;diff=19016</id>
		<title>CSC/ECE 517 Fall 2009/wiki 1a 9b SJ</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a_9b_SJ&amp;diff=19016"/>
		<updated>2009-09-09T20:15:03Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is Code Refactoring ==&lt;br /&gt;
According to the famous book &amp;quot;Refactoring: Improving the Design of Existing Code &amp;quot; by Martin Fowler: Refactoring is the process of applying behavior-preserving transformations to a program with the objective of improving the program’s design. Intuitively people refer to code refactoring as &amp;quot;cleaning it up&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Motivation of Refactoring ===&lt;br /&gt;
Refactoring is very useful for software engineer to maintain the quality of their code in different environment. In fact, no software can be guaranteed to be perfect when it is first developed. Usually when the source code is applied to different customer needs, we want to improve the inner-structure without modify the external behavior. The ability to refactor your code takes the pressure off the design phase of software development. Refactoring gives you the ability to change the design of the code at a later stage. This means that you don’t have to get the design absolutely right before you write any code. You can get a rough design worked out, code it up and then if (when) you spot a better design you can refactor your code towards the better design.&lt;br /&gt;
&lt;br /&gt;
=== List of Common Refactorings ===&lt;br /&gt;
In the following we list some popular refactoring to specify how refactoring transform the code. For more detail information, the reader please refer to the section 2.1.2 of the thesis of Thomas Corbat[1]. [1] provide Ruby example for each refactoring this list .   &lt;br /&gt;
  &lt;br /&gt;
{|&lt;br /&gt;
| 1. Merge Class Parts &lt;br /&gt;
|-&lt;br /&gt;
|	2. Convert Local Variable to Field &lt;br /&gt;
|-&lt;br /&gt;
|	3. Encapsulate Field &lt;br /&gt;
|-&lt;br /&gt;
|	4. Extract Method &lt;br /&gt;
|-&lt;br /&gt;
|	5. Inline Class &lt;br /&gt;
|-&lt;br /&gt;
|	6. Inline Method &lt;br /&gt;
|-&lt;br /&gt;
|	7. Move Field &lt;br /&gt;
|-&lt;br /&gt;
|	8. Move Method &lt;br /&gt;
|-&lt;br /&gt;
|	9. Rename Class &lt;br /&gt;
|-&lt;br /&gt;
|	10. Rename Field &lt;br /&gt;
|-&lt;br /&gt;
|	11. Rename Local Variable &lt;br /&gt;
|-&lt;br /&gt;
|	12. Rename Method &lt;br /&gt;
|-&lt;br /&gt;
|	13. Replace Temporary Variable with Query &lt;br /&gt;
|-&lt;br /&gt;
|	14. Split Temporary Variable &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Ruby Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 def badRenameMethod&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 def hello&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
 &lt;br /&gt;
 class SomeClass&lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 class SomeClass                &lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    def field&lt;br /&gt;
        @field&lt;br /&gt;
    end&lt;br /&gt;
    private :field&lt;br /&gt;
    &lt;br /&gt;
    def field= field&lt;br /&gt;
        @field = field&lt;br /&gt;
    end&lt;br /&gt;
    private :field=&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Java Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void badRenameMethod()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void hello()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    public String field;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    private int field;&lt;br /&gt;
&lt;br /&gt;
    public void setField(int field)&lt;br /&gt;
    {&lt;br /&gt;
        this.field = field;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getField()&lt;br /&gt;
    {&lt;br /&gt;
        return field;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Refactoring support for Current Ruby IDE ==&lt;br /&gt;
This the following table we summary the current ruby IDE and their refactoring support situation. &lt;br /&gt;
{| &lt;br /&gt;
 | Current Ruby IDE || Refactoring Support (Y/N)&lt;br /&gt;
|-&lt;br /&gt;
 | ActiveState Komodo  || N&lt;br /&gt;
 |- &lt;br /&gt;
 | NetBeans || N&lt;br /&gt;
 |-&lt;br /&gt;
 | Arachno Ruby ||  N&lt;br /&gt;
|-&lt;br /&gt;
 | FreeRIDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Mondrian Ruby IDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Ruby in Steel || N&lt;br /&gt;
|-&lt;br /&gt;
 | RubyMine || Y&lt;br /&gt;
|-&lt;br /&gt;
 | Eclipse (Aptana) || Y  &lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Ruby Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:r01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:r02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:r03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:r04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r05.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:r06.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:r07.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:r08.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
| [[Image:r09.jpg|thumb|upright|alt= encapsulation step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Java Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Java. The source code is show in section 1.4. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:j01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:j02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:j03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:j04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
| [[Image:j05.jpg|thumb|upright|alt= rename step 6]]&lt;br /&gt;
|}&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Java. The source code is show in section 1.4.&lt;br /&gt;
 &lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j06.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:j07.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:j08.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:j09.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Comparison of Ruby and Java Refactoring Tools ==&lt;br /&gt;
Comprehensiveness comparison:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|1. Refactoring Options for Java in Eclipse  ||||  2. Refactoring Options in Eclipse for Ruby&lt;br /&gt;
|-&lt;br /&gt;
|Rename   || || Rename&lt;br /&gt;
|-&lt;br /&gt;
|Move || || Move&lt;br /&gt;
|-&lt;br /&gt;
|Change Method Signature || || Merge Class Parts in File&lt;br /&gt;
|-&lt;br /&gt;
|Extract Local Variable || || Pull Up&lt;br /&gt;
|-&lt;br /&gt;
|Extract Constant || || Pull Down&lt;br /&gt;
|-&lt;br /&gt;
|Inline || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Anonymous Class to Nested || || Split Local Variable&lt;br /&gt;
|-&lt;br /&gt;
|Convert Member to Top Level || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Local Variable to Field || || Inline&lt;br /&gt;
|-&lt;br /&gt;
|Extract Super Class || || Extract Constant&lt;br /&gt;
|-&lt;br /&gt;
|Extract Interface || || Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Extract Class || || Convert Local Variable to Field&lt;br /&gt;
|-&lt;br /&gt;
|Use Supertype where possible&lt;br /&gt;
|-&lt;br /&gt;
|Pull Up &lt;br /&gt;
|-&lt;br /&gt;
|Pull Down &lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter Object&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Indirection&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Factory&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter&lt;br /&gt;
|-&lt;br /&gt;
|Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Generalize Declared Type&lt;br /&gt;
|-&lt;br /&gt;
|Infer Generic Type Arguments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The refactoring options for Ruby and Java cover all the basic refactorings.  The differences in the number of options mainly come from the difference in the two languages.  Ruby is a dynamically typed language, has unbounded polymorphism, and all classes are open to extension.  On the other hand, Java is a statically typed language, polymorphism is mainly implemented via interfaces and inheritance, and classes cannot be extended at runtime.  The given examples (in section 1.3, 1.4) illustrate the ease of use of the refactoring tools for both Ruby and Java and how well these tools are integrated into the Eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] Thomas Corbat, Lukas Felber, Mirko Stocker&lt;br /&gt;
Refactoring Support for the Eclipse Ruby Development Tools, Diploma Thesis, HSR University of Applied Sciences Rapperswil Institute for Software&lt;br /&gt;
&lt;br /&gt;
[2] code refactoring wiki, http://en.wikipedia.org/wiki/Code_refactoring&lt;br /&gt;
&lt;br /&gt;
[3] the first workshop on refactoring, https://netfiles.uiuc.edu/dig/RefactoringWorkshop&lt;br /&gt;
&lt;br /&gt;
[4] refactoring tutorial on ruby on rail, http://www.good-tutorials.com/tutorials/ruby-on-rails/refactoring&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a_9b_SJ&amp;diff=19015</id>
		<title>CSC/ECE 517 Fall 2009/wiki 1a 9b SJ</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a_9b_SJ&amp;diff=19015"/>
		<updated>2009-09-09T20:06:16Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is Code Refactoring ==&lt;br /&gt;
According to the famous book &amp;quot;Refactoring: Improving the Design of Existing Code &amp;quot; by Martin Fowler: Refactoring is the process of applying behavior-preserving transformations to a program with the objective of improving the program’s design. Intuitively people refer to code refactoring as &amp;quot;cleaning it up&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Motivation of Refactoring ===&lt;br /&gt;
Refactoring is very useful for software engineer to maintain the quality of their code in different environment. In fact, no software can be guaranteed to be perfect when it is first developed. Usually when the source code is applied to different customer needs, we want to improve the inner-structure without modify the external behavior. The ability to refactor your code takes the pressure off the design phase of software development. Refactoring gives you the ability to change the design of the code at a later stage. This means that you don’t have to get the design absolutely right before you write any code. You can get a rough design worked out, code it up and then if (when) you spot a better design you can refactor your code towards the better design.&lt;br /&gt;
&lt;br /&gt;
=== List of Common Refactorings ===&lt;br /&gt;
In the following we list some popular refactoring to specify how refactoring transform the code. For more detail information, the reader please refer to the section 2.1.2 of the thesis of Thomas Corbat[1]. [1] provide Ruby example for each refactoring this list.   &lt;br /&gt;
  &lt;br /&gt;
{|&lt;br /&gt;
| 1. Merge Class Parts &lt;br /&gt;
|-&lt;br /&gt;
|	2. Convert Local Variable to Field &lt;br /&gt;
|-&lt;br /&gt;
|	3. Encapsulate Field &lt;br /&gt;
|-&lt;br /&gt;
|	4. Extract Method &lt;br /&gt;
|-&lt;br /&gt;
|	5. Inline Class &lt;br /&gt;
|-&lt;br /&gt;
|	6. Inline Method &lt;br /&gt;
|-&lt;br /&gt;
|	7. Move Field &lt;br /&gt;
|-&lt;br /&gt;
|	8. Move Method &lt;br /&gt;
|-&lt;br /&gt;
|	9. Rename Class &lt;br /&gt;
|-&lt;br /&gt;
|	10. Rename Field &lt;br /&gt;
|-&lt;br /&gt;
|	11. Rename Local Variable &lt;br /&gt;
|-&lt;br /&gt;
|	12. Rename Method &lt;br /&gt;
|-&lt;br /&gt;
|	13. Replace Temporary Variable with Query &lt;br /&gt;
|-&lt;br /&gt;
|	14. Split Temporary Variable &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Ruby Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 def badRenameMethod&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 def hello&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
 &lt;br /&gt;
 class SomeClass&lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 class SomeClass                &lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    def field&lt;br /&gt;
        @field&lt;br /&gt;
    end&lt;br /&gt;
    private :field&lt;br /&gt;
    &lt;br /&gt;
    def field= field&lt;br /&gt;
        @field = field&lt;br /&gt;
    end&lt;br /&gt;
    private :field=&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Java Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void badRenameMethod()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void hello()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    public String field;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    private int field;&lt;br /&gt;
&lt;br /&gt;
    public void setField(int field)&lt;br /&gt;
    {&lt;br /&gt;
        this.field = field;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getField()&lt;br /&gt;
    {&lt;br /&gt;
        return field;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Refactoring support for Current Ruby IDE ==&lt;br /&gt;
This the following table we summary the current ruby IDE and their refactoring support situation. &lt;br /&gt;
{| &lt;br /&gt;
 | Current Ruby IDE || Refactoring Support (Y/N)&lt;br /&gt;
|-&lt;br /&gt;
 | ActiveState Komodo  || N&lt;br /&gt;
 |- &lt;br /&gt;
 | NetBeans || N&lt;br /&gt;
 |-&lt;br /&gt;
 | Arachno Ruby ||  N&lt;br /&gt;
|-&lt;br /&gt;
 | FreeRIDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Mondrian Ruby IDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Ruby in Steel || N&lt;br /&gt;
|-&lt;br /&gt;
 | RubyMine || Y&lt;br /&gt;
|-&lt;br /&gt;
 | Eclipse (Aptana) || Y  &lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Ruby Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:r01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:r02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:r03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:r04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r05.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:r06.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:r07.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:r08.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
| [[Image:r09.jpg|thumb|upright|alt= encapsulation step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Java Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Java. The source code is show in section 1.4. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:j01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:j02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:j03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:j04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
| [[Image:j05.jpg|thumb|upright|alt= rename step 6]]&lt;br /&gt;
|}&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Java. The source code is show in section 1.4.&lt;br /&gt;
 &lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j06.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:j07.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:j08.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:j09.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Comparison of Ruby and Java Refactoring Tools ==&lt;br /&gt;
Comprehensiveness comparison:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|1. Refactoring Options for Java in Eclipse  ||||  2. Refactoring Options in Eclipse for Ruby&lt;br /&gt;
|-&lt;br /&gt;
|Rename   || || Rename&lt;br /&gt;
|-&lt;br /&gt;
|Move || || Move&lt;br /&gt;
|-&lt;br /&gt;
|Change Method Signature || || Merge Class Parts in File&lt;br /&gt;
|-&lt;br /&gt;
|Extract Local Variable || || Pull Up&lt;br /&gt;
|-&lt;br /&gt;
|Extract Constant || || Pull Down&lt;br /&gt;
|-&lt;br /&gt;
|Inline || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Anonymous Class to Nested || || Split Local Variable&lt;br /&gt;
|-&lt;br /&gt;
|Convert Member to Top Level || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Local Variable to Field || || Inline&lt;br /&gt;
|-&lt;br /&gt;
|Extract Super Class || || Extract Constant&lt;br /&gt;
|-&lt;br /&gt;
|Extract Interface || || Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Extract Class || || Convert Local Variable to Field&lt;br /&gt;
|-&lt;br /&gt;
|Use Supertype where possible&lt;br /&gt;
|-&lt;br /&gt;
|Pull Up &lt;br /&gt;
|-&lt;br /&gt;
|Pull Down &lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter Object&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Indirection&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Factory&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter&lt;br /&gt;
|-&lt;br /&gt;
|Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Generalize Declared Type&lt;br /&gt;
|-&lt;br /&gt;
|Infer Generic Type Arguments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The refactoring options for Ruby and Java cover all the basic refactorings.  The differences in the number of options mainly come from the difference in the two languages.  Ruby is a dynamically typed language, has unbounded polymorphism, and all classes are open to extension.  On the other hand, Java is a statically typed language, polymorphism is mainly implemented via interfaces and inheritance, and classes cannot be extended at runtime.  The given examples (in section 1.3, 1.4) illustrate the ease of use of the refactoring tools for both Ruby and Java and how well these tools are integrated into the Eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] Thomas Corbat, Lukas Felber, Mirko Stocker&lt;br /&gt;
Refactoring Support for the Eclipse Ruby Development Tools, Diploma Thesis, HSR University of Applied Sciences Rapperswil Institute for Software&lt;br /&gt;
&lt;br /&gt;
[2] code refactoring wiki, http://en.wikipedia.org/wiki/Code_refactoring&lt;br /&gt;
&lt;br /&gt;
[3] the first workshop on refactoring, https://netfiles.uiuc.edu/dig/RefactoringWorkshop&lt;br /&gt;
&lt;br /&gt;
[4] refactoring tutorial on ruby on rail, http://www.good-tutorials.com/tutorials/ruby-on-rails/refactoring&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a&amp;diff=18728</id>
		<title>CSC/ECE 517 Fall 2009/wiki 1a</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a&amp;diff=18728"/>
		<updated>2009-09-08T18:12:18Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a&amp;diff=18727</id>
		<title>CSC/ECE 517 Fall 2009/wiki 1a</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki_1a&amp;diff=18727"/>
		<updated>2009-09-08T18:11:44Z</updated>

		<summary type="html">&lt;p&gt;Gohan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is Code Refactoring ==&lt;br /&gt;
According to the famous book &amp;quot;Refactoring: Improving the Design of Existing Code &amp;quot; by Martin Fowler: Refactoring is the process of applying behavior-preserving transformations to a program with the objective of improving the program’s design. Intuitively people refer to code refactoring as &amp;quot;cleaning it up&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Motivation of Refactoring ===&lt;br /&gt;
Refactoring is very useful for software engineer to maintain the quality of their code in different environment. In fact, no software can be guaranteed to be perfect when it is first developed. Usually when the source code is applied to different customer needs, we want to improve the inner-structure without modify the external behavior. The ability to refactor your code takes the pressure off the design phase of software development. Refactoring gives you the ability to change the design of the code at a later stage. This means that you don’t have to get the design absolutely right before you write any code. You can get a rough design worked out, code it up and then if (when) you spot a better design you can refactor your code towards the better design.&lt;br /&gt;
&lt;br /&gt;
===List of Common Refactorings===&lt;br /&gt;
In the following we list some popular refactoring to specify how refactoring transform the code. For more detail information, the reader please refer to the section 2.1.2 of the thesis of Thomas Corbat[1]. [1] provide Ruby example for each refactoring this list.   &lt;br /&gt;
  &lt;br /&gt;
{|&lt;br /&gt;
| 1. Merge Class Parts &lt;br /&gt;
|-&lt;br /&gt;
|	2. Convert Local Variable to Field &lt;br /&gt;
|-&lt;br /&gt;
|	3. Encapsulate Field &lt;br /&gt;
|-&lt;br /&gt;
|	4. Extract Method &lt;br /&gt;
|-&lt;br /&gt;
|	5. Inline Class &lt;br /&gt;
|-&lt;br /&gt;
|	6. Inline Method &lt;br /&gt;
|-&lt;br /&gt;
|	7. Move Field &lt;br /&gt;
|-&lt;br /&gt;
|	8. Move Method &lt;br /&gt;
|-&lt;br /&gt;
|	9. Rename Class &lt;br /&gt;
|-&lt;br /&gt;
|	10. Rename Field &lt;br /&gt;
|-&lt;br /&gt;
|	11. Rename Local Variable &lt;br /&gt;
|-&lt;br /&gt;
|	12. Rename Method &lt;br /&gt;
|-&lt;br /&gt;
|	13. Replace Temporary Variable with Query &lt;br /&gt;
|-&lt;br /&gt;
|	14. Split Temporary Variable &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Ruby Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 def badRenameMethod&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 def hello&lt;br /&gt;
    puts(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
 &lt;br /&gt;
 class SomeClass&lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 class SomeClass                &lt;br /&gt;
    def initialize&lt;br /&gt;
        @field = 0;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    def field&lt;br /&gt;
        @field&lt;br /&gt;
    end&lt;br /&gt;
    private :field&lt;br /&gt;
    &lt;br /&gt;
    def field= field&lt;br /&gt;
        @field = field&lt;br /&gt;
    end&lt;br /&gt;
    private :field=&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Java Example of Refactoring ===&lt;br /&gt;
before rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void badRenameMethod()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after rename:&lt;br /&gt;
&lt;br /&gt;
 public class rename_method&lt;br /&gt;
 {&lt;br /&gt;
    static void hello()&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
before encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    public String field;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
after encapsulation:&lt;br /&gt;
&lt;br /&gt;
 public class encap_field&lt;br /&gt;
 {&lt;br /&gt;
    private int field;&lt;br /&gt;
&lt;br /&gt;
    public void setField(int field)&lt;br /&gt;
    {&lt;br /&gt;
        this.field = field;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getField()&lt;br /&gt;
    {&lt;br /&gt;
        return field;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Refactoring support for Current Ruby IDE ==&lt;br /&gt;
This the following table we summary the current ruby IDE and their refactoring support situation. &lt;br /&gt;
{| &lt;br /&gt;
 | Current Ruby IDE || Refactoring Support (Y/N)&lt;br /&gt;
|-&lt;br /&gt;
 | ActiveState Komodo  || N&lt;br /&gt;
 |- &lt;br /&gt;
 | NetBeans || N&lt;br /&gt;
 |-&lt;br /&gt;
 | Arachno Ruby ||  N&lt;br /&gt;
|-&lt;br /&gt;
 | FreeRIDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Mondrian Ruby IDE || N&lt;br /&gt;
|-&lt;br /&gt;
 | Ruby in Steel || N&lt;br /&gt;
|-&lt;br /&gt;
 | RubyMine || Y&lt;br /&gt;
|-&lt;br /&gt;
 | Eclipse (Aptana) || Y  &lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Ruby Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:r01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:r02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:r03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:r04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Ruby.  The source code is show in section 1.3.&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:r05.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:r06.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:r07.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:r08.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
| [[Image:r09.jpg|thumb|upright|alt= encapsulation step 5]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example of Using Java Refactoring Tools in Eclipse ===&lt;br /&gt;
Here the renaming of the method &amp;quot;badRenameMethod&amp;quot; to &amp;quot;Hello&amp;quot; is illustrated for Java. The source code is show in section 1.4. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j00.jpg|thumb|upright|alt= rename step 1]]&lt;br /&gt;
| [[Image:j01.jpg|thumb|upright|alt= rename step 2]]&lt;br /&gt;
| [[Image:j02.jpg|thumb|upright|alt= rename step 3]]&lt;br /&gt;
| [[Image:j03.jpg|thumb|upright|alt= rename step 4]]&lt;br /&gt;
| [[Image:j04.jpg|thumb|upright|alt= rename step 5]]&lt;br /&gt;
| [[Image:j05.jpg|thumb|upright|alt= rename step 6]]&lt;br /&gt;
|}&lt;br /&gt;
Here the encapsulation of the field &amp;quot;field&amp;quot; is illustrated for Java. The source code is show in section 1.4.&lt;br /&gt;
 &lt;br /&gt;
{|&lt;br /&gt;
| [[Image:j06.jpg|thumb|upright|alt= encapsulation step 1]]&lt;br /&gt;
| [[Image:j07.jpg|thumb|upright|alt= encapsulation step 2]]&lt;br /&gt;
| [[Image:j08.jpg|thumb|upright|alt= encapsulation step 3]]&lt;br /&gt;
| [[Image:j09.jpg|thumb|upright|alt= encapsulation step 4]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Comparison of Ruby and Java Refactoring Tools ==&lt;br /&gt;
Comprehensiveness comparison:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|1. Refactoring Options for Java in Eclipse  ||||  2. Refactoring Options in Eclipse for Ruby&lt;br /&gt;
|-&lt;br /&gt;
|Rename   || || Rename&lt;br /&gt;
|-&lt;br /&gt;
|Move || || Move&lt;br /&gt;
|-&lt;br /&gt;
|Change Method Signature || || Merge Class Parts in File&lt;br /&gt;
|-&lt;br /&gt;
|Extract Local Variable || || Pull Up&lt;br /&gt;
|-&lt;br /&gt;
|Extract Constant || || Pull Down&lt;br /&gt;
|-&lt;br /&gt;
|Inline || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Anonymous Class to Nested || || Split Local Variable&lt;br /&gt;
|-&lt;br /&gt;
|Convert Member to Top Level || || Merge With External Class Parts&lt;br /&gt;
|-&lt;br /&gt;
|Convert Local Variable to Field || || Inline&lt;br /&gt;
|-&lt;br /&gt;
|Extract Super Class || || Extract Constant&lt;br /&gt;
|-&lt;br /&gt;
|Extract Interface || || Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Extract Class || || Convert Local Variable to Field&lt;br /&gt;
|-&lt;br /&gt;
|Use Supertype where possible&lt;br /&gt;
|-&lt;br /&gt;
|Pull Up &lt;br /&gt;
|-&lt;br /&gt;
|Pull Down &lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter Object&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Indirection&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Factory&lt;br /&gt;
|-&lt;br /&gt;
|Introduce Parameter&lt;br /&gt;
|-&lt;br /&gt;
|Encapsulate Field&lt;br /&gt;
|-&lt;br /&gt;
|Generalize Declared Type&lt;br /&gt;
|-&lt;br /&gt;
|Infer Generic Type Arguments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The refactoring options for Ruby and Java cover all the basic refactorings.  The differences in the number of options mainly come from the difference in the two languages.  Ruby is a dynamically typed language, has unbounded polymorphism, and all classes are open to extension.  On the other hand, Java is a statically typed language, polymorphism is mainly implemented via interfaces and inheritance, and classes cannot be extended at runtime.  The given examples (in section 1.3, 1.4) illustrate the ease of use of the refactoring tools for both Ruby and Java and how well these tools are integrated into the Eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[1] Thomas Corbat, Lukas Felber, Mirko Stocker&lt;br /&gt;
Refactoring Support for the Eclipse Ruby Development Tools, Diploma Thesis, HSR University of Applied Sciences Rapperswil Institute for Software&lt;br /&gt;
&lt;br /&gt;
[2] code refactoring wiki, http://en.wikipedia.org/wiki/Code_refactoring&lt;br /&gt;
&lt;br /&gt;
[3] the first workshop on refactoring, https://netfiles.uiuc.edu/dig/RefactoringWorkshop&lt;br /&gt;
&lt;br /&gt;
[4] refactoring tutorial on ruby on rail, http://www.good-tutorials.com/tutorials/ruby-on-rails/refactoring&lt;/div&gt;</summary>
		<author><name>Gohan</name></author>
	</entry>
</feed>