<?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=Stphung</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=Stphung"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Stphung"/>
	<updated>2026-06-03T21:17:44Z</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_20_i7&amp;diff=29240</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29240"/>
		<updated>2009-11-19T01:56:59Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Invariants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, a GpsLocationProvider is a subtype to LocationProvider.  However, the GpsLocationProvider has a precondition which the LocationProvider does not which is that it requires a GPS fix to get a location.  This creates a new precondition which LocationProvider does not require.  Liskov substitution would not be possible here since you could not treat a GpsLocationProvider as a LocationProvider.&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
    ...&lt;br /&gt;
    public boolean contains(T element) {&lt;br /&gt;
        this.remove(t)&lt;br /&gt;
        // -- Wait!  I can't do that, a postcondition to calling contains is that the list is unmodified.&lt;br /&gt;
        //           The removal of this postcondition in this list would mean this class has less postconditions then the parent.&lt;br /&gt;
        //           This is not good!&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, we have a MyList which is a subtype to List.  For one reason or another we want to also remove the element if we call contains on it.  This violates a postcondition that the list must remain unmodified when calling contains.  Due to this violation, we would not be able to use Liskov substitution here.  In fact, substituting this List implementation into a program which uses List could be disastrous!&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Rectangle(double width, double height) {&lt;br /&gt;
        this.width = width;&lt;br /&gt;
        this.height = height;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double getWidth() {return this.width;}&lt;br /&gt;
    public double getHeight() {return this.height;}&lt;br /&gt;
&lt;br /&gt;
    public double setWidth(int width) {this.width= width;}&lt;br /&gt;
    public double setHeight(int height) {this.height = height;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Square extends Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Square(double side) {&lt;br /&gt;
        super(side, side);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double setSide(int side) {&lt;br /&gt;
        super.setWidth(side);&lt;br /&gt;
        super.setHeight(side);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example is a classic example used when discussing Liskov substitution.  There is a Rectangle class which has two data members, the height and width, constructors, getters, and setters are provided.  In the subtype, Square, we want to have the sides be equal, therefore we delegate calls to the parent in order to do so.  In this naive example, if a programmer does not have access to the source code they can violate an invariant of the Square class which is that the sides must be equal.  Continuing our example this would look like the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle square = new Square(1);&lt;br /&gt;
square.setSide(5); // This is ok, both our sides are equal to 5 now!&lt;br /&gt;
square.setWidth(2); // This is not ok, both height and width of the Square are not equal at this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29206</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29206"/>
		<updated>2009-11-19T01:50:15Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Postconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, a GpsLocationProvider is a subtype to LocationProvider.  However, the GpsLocationProvider has a precondition which the LocationProvider does not which is that it requires a GPS fix to get a location.  This creates a new precondition which LocationProvider does not require.  Liskov substitution would not be possible here since you could not treat a GpsLocationProvider as a LocationProvider.&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
    ...&lt;br /&gt;
    public boolean contains(T element) {&lt;br /&gt;
        this.remove(t)&lt;br /&gt;
        // -- Wait!  I can't do that, a postcondition to calling contains is that the list is unmodified.&lt;br /&gt;
        //           The removal of this postcondition in this list would mean this class has less postconditions then the parent.&lt;br /&gt;
        //           This is not good!&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, we have a MyList which is a subtype to List.  For one reason or another we want to also remove the element if we call contains on it.  This violates a postcondition that the list must remain unmodified when calling contains.  Due to this violation, we would not be able to use Liskov substitution here.  In fact, substituting this List implementation into a program which uses List could be disastrous!&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Rectangle(double width, double height) {&lt;br /&gt;
        this.width = width;&lt;br /&gt;
        this.height = height;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double getWidth() {return this.width;}&lt;br /&gt;
    public double getHeight() {return this.height;}&lt;br /&gt;
&lt;br /&gt;
    public double setWidth(int width) {this.width= width;}&lt;br /&gt;
    public double setHeight(int height) {this.height = height;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Square extends Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Square(double side) {&lt;br /&gt;
        super(side, side);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double setSide(int side) {&lt;br /&gt;
        super.setWidth(side);&lt;br /&gt;
        super.setHeight(side);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29188</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29188"/>
		<updated>2009-11-19T01:45:40Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, a GpsLocationProvider is a subtype to LocationProvider.  However, the GpsLocationProvider has a precondition which the LocationProvider does not which is that it requires a GPS fix to get a location.  This creates a new precondition which LocationProvider does not require.  Liskov substitution would not be possible here since you could not treat a GpsLocationProvider as a LocationProvider.&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SelectiveCountingList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
    ...&lt;br /&gt;
    public boolean contains(T element) {&lt;br /&gt;
        this.remove(t)&lt;br /&gt;
        // -- Wait!  I can't do that, a postcondition to calling contains is that the list is unmodified.&lt;br /&gt;
        //           The removal of this postcondition in this list would mean this class has less postconditions then the parent.&lt;br /&gt;
        //           This is not good!&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Rectangle(double width, double height) {&lt;br /&gt;
        this.width = width;&lt;br /&gt;
        this.height = height;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double getWidth() {return this.width;}&lt;br /&gt;
    public double getHeight() {return this.height;}&lt;br /&gt;
&lt;br /&gt;
    public double setWidth(int width) {this.width= width;}&lt;br /&gt;
    public double setHeight(int height) {this.height = height;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Square extends Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Square(double side) {&lt;br /&gt;
        super(side, side);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double setSide(int side) {&lt;br /&gt;
        super.setWidth(side);&lt;br /&gt;
        super.setHeight(side);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29181</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29181"/>
		<updated>2009-11-19T01:43:09Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Invariants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SelectiveCountingList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
    ...&lt;br /&gt;
    public boolean contains(T element) {&lt;br /&gt;
        this.remove(t)&lt;br /&gt;
        // -- Wait!  I can't do that, a postcondition to calling contains is that the list is unmodified.&lt;br /&gt;
        //           The removal of this postcondition in this list would mean this class has less postconditions then the parent.&lt;br /&gt;
        //           This is not good!&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Rectangle(double width, double height) {&lt;br /&gt;
        this.width = width;&lt;br /&gt;
        this.height = height;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double getWidth() {return this.width;}&lt;br /&gt;
    public double getHeight() {return this.height;}&lt;br /&gt;
&lt;br /&gt;
    public double setWidth(int width) {this.width= width;}&lt;br /&gt;
    public double setHeight(int height) {this.height = height;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Square extends Rectangle {&lt;br /&gt;
    private double width;&lt;br /&gt;
    private double height;&lt;br /&gt;
    &lt;br /&gt;
    public Square(double side) {&lt;br /&gt;
        super(side, side);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public double setSide(int side) {&lt;br /&gt;
        super.setWidth(side);&lt;br /&gt;
        super.setHeight(side);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29173</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29173"/>
		<updated>2009-11-19T01:39:27Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Postconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SelectiveCountingList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
    ...&lt;br /&gt;
    public boolean contains(T element) {&lt;br /&gt;
        this.remove(t)&lt;br /&gt;
        // -- Wait!  I can't do that, a postcondition to calling contains is that the list is unmodified.&lt;br /&gt;
        //           The removal of this postcondition in this list would mean this class has less postconditions then the parent.&lt;br /&gt;
        //           This is not good!&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29033</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29033"/>
		<updated>2009-11-19T00:47:58Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29 abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29031</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29031"/>
		<updated>2009-11-19T00:47:13Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider implements LocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29028</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29028"/>
		<updated>2009-11-19T00:46:28Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Postconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyList&amp;lt;T&amp;gt; implements List&amp;lt;T&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29027</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29027"/>
		<updated>2009-11-19T00:45:32Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be substituted for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29024</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=29024"/>
		<updated>2009-11-19T00:44:04Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle is a object oriented design principle was introduced by Barbara Liskov in 1987 and is concerned with subtyping and contractual adherence.  This principle is part of the [http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29 SOLID] principles of object oriented design which is an acronym for the five basic class design principles and relates to many object oriented design principles.  The basic idea behind the object oriented design principles is to create and apply proper [http://en.wikipedia.org/wiki/Abstraction abstractions].  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28996</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28996"/>
		<updated>2009-11-19T00:31:53Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28995</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28995"/>
		<updated>2009-11-19T00:31:35Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &lt;br /&gt;
&lt;br /&gt;
&amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28980</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28980"/>
		<updated>2009-11-19T00:27:22Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Postconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Postcondition postconditions] cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28977</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28977"/>
		<updated>2009-11-19T00:27:02Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Precondition preconditions] cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28967</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28967"/>
		<updated>2009-11-19T00:25:41Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28960</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28960"/>
		<updated>2009-11-19T00:24:53Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The Liskov substitution principle is a guideline on subtyping existing classes.  The purpose of Liskov substitution is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28746</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28746"/>
		<updated>2009-11-18T21:59:18Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
The point of the Liskov substitution principle is to ensure that subtypes adhere to their contracts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concisely:&lt;br /&gt;
*Subtypes must not require anymore preconditions as it violates the contract they are based on.  &lt;br /&gt;
*Subtypes must have at least the same set of postconditions to adhere to the contract they are based on.  &lt;br /&gt;
*Subtypes must have the same invariants to ensure consistency.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using these properties subtypes can be exchanged for base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28733</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28733"/>
		<updated>2009-11-18T21:47:49Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  In other words, properties that are assumed to be true must always remain true.  This property lends itself to being self explained by the quality of correctness.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rectangle/Square example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
Have subtypes be substitutable for their base types.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28729</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28729"/>
		<updated>2009-11-18T21:44:14Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28728</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28728"/>
		<updated>2009-11-18T21:44:02Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28727</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28727"/>
		<updated>2009-11-18T21:43:36Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot have fewer postconditions than the parent. This makes sense because if the subtype did not at least adhere to the postconditions of the parent, it could not be substituted for it simply because postconditions we assumed to be true would not be.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
When dealing with Liskov substitution, [http://en.wikipedia.org/wiki/Invariant invariants] must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28706</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28706"/>
		<updated>2009-11-18T21:33:21Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  Plainly, we want subtypes to be substitutable for their base types as Robert Martin put it.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28703</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28703"/>
		<updated>2009-11-18T21:32:23Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
== Definition ==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28700</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28700"/>
		<updated>2009-11-18T21:31:49Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more &lt;br /&gt;
     *                                               than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others &lt;br /&gt;
     *                                               would need to know that the underlying implementation &lt;br /&gt;
     *                                               of a LocationProvider is a GpsLocation provider and &lt;br /&gt;
     *                                               to get a GPS fix if so before calling getLocation(), &lt;br /&gt;
     *                                               we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28693</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28693"/>
		<updated>2009-11-18T21:29:01Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others would need to know that the underlying&lt;br /&gt;
     *                                               implementation of a LocationProvider is a GpsLocation provider and to get a GPS fix if so before&lt;br /&gt;
     *                                               calling getLocation(), we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;br /&gt;
*http://www.davidhayden.com/blog/dave/archive/2005/06/10/1226.aspx&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28454</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28454"/>
		<updated>2009-11-18T18:29:40Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface LocationProvider {&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: None&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class GpsLocationProvider {&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     *&lt;br /&gt;
     * Preconditions: A GPS fix must be present.  -- Wait! I can't do that because I would be requiring more than what the interface requires which &lt;br /&gt;
     *                                               violates this principle.  Doing this would mean others would need to know that the underlying&lt;br /&gt;
     *                                               implementation of a LocationProvider is a GpsLocation provider and to get a GPS fix if so before&lt;br /&gt;
     *                                               calling getLocation(), we don't want that!&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public void getLocation() {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28317</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28317"/>
		<updated>2009-11-18T09:18:59Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  Intuitively, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example code here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
When dealing with Liskov substitution, postconditions cannot be weakened.  Intuitively, the subtype cannot require any less postconditions than the parent. &amp;lt;CONTINUE HERE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28316</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28316"/>
		<updated>2009-11-18T09:15:53Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  This is fairly intuitive, in other words, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example code here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28314</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28314"/>
		<updated>2009-11-18T09:15:33Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Preconditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
When dealing with Liskov substitution, preconditions cannot be strengthened.  This is fairly intuitive, in other words, the subtype cannot require anymore preconditions than the parent.  This makes sense because if the subtype required more than the parent, then the subtype would not be able to be effectively substituted in for the parent transparently.  There would need to be more preconditions satisfied after substituting in the subtype in this hypothetical situation.  Take for instance this example in Java which illustrates this point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example code here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28310</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28310"/>
		<updated>2009-11-18T09:10:17Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of List to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28308</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28308"/>
		<updated>2009-11-18T09:06:22Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of list to create a new MyClass and observe identical behavior!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28307</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28307"/>
		<updated>2009-11-18T09:05:04Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of list to create a new MyClass in my program!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28306</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28306"/>
		<updated>2009-11-18T09:04:34Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    private final List&amp;lt;String&amp;gt; list;&lt;br /&gt;
    public MyClass(List&amp;lt;String&amp;gt; list) {&lt;br /&gt;
        this.list = list;&lt;br /&gt;
    }&lt;br /&gt;
    ....&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class TestRunner {&lt;br /&gt;
    public static void main ( String[] args ) {&lt;br /&gt;
        // If the List type follows Liskov substitution...&lt;br /&gt;
        List&amp;lt;String&amp;gt; arrayList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;
        List&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;String&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
        // ...I should be able to use any subtype of list to create a new MyClass!&lt;br /&gt;
        MyClass this = new MyClass(arrayList);&lt;br /&gt;
        MyClass works = new MyClass(linkedList);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28305</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28305"/>
		<updated>2009-11-18T08:56:58Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Liskov substitution principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same.  The following example in Java illustrates the the principle.&lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28303</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28303"/>
		<updated>2009-11-18T08:53:46Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same. &lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28302</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28302"/>
		<updated>2009-11-18T08:53:32Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same. &lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*http://en.wikipedia.org/wiki/Liskov_substitution_principle&lt;br /&gt;
*http://javaboutique.internet.com/tutorials/JavaOO/&lt;br /&gt;
*http://www.codingefficiency.com/2009/07/21/solid-l-liskov-substitution-principle/&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28300</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28300"/>
		<updated>2009-11-18T08:50:56Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same. &lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28299</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28299"/>
		<updated>2009-11-18T08:50:24Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liskov substitution principle =&lt;br /&gt;
&lt;br /&gt;
==The Principle==&lt;br /&gt;
The Liskov substitution principle was introduced by Barbara Liskov in 1987 and is concerned with subtype contractual correctness.  Based on a paper from 1994 the principle states, &amp;quot;Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.&amp;quot;.  This means that for every parent type T, subtype S should be able to be substituted in for it and the behavior of the program should remain exactly the same. &lt;br /&gt;
&lt;br /&gt;
==Preconditions==&lt;br /&gt;
Preconditions cannot be strengthened. &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&amp;lt;Example&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Postconditions==&lt;br /&gt;
Postconditions cannot be weakened.  &amp;lt;Explain in english&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invariants==&lt;br /&gt;
Invariants must be preserved.  &amp;lt;Explain in english&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28280</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 20 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_20_i7&amp;diff=28280"/>
		<updated>2009-11-18T07:54:07Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Liskov Substitution Principle&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23597</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23597"/>
		<updated>2009-10-09T05:08:47Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Problem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Serializable] interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The idiom for implementing serialization proxy pattern is using an inner class that is declared as private, static, and final.  The reason the class is declared private is because it should not be visible to anyone other then the enclosing class, static is because it should not share any instance variables with the parent, and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Using the serialization proxy pattern brings a two important benefits to the table when dealing with serialization of immutable classes.  First, serialization is made possible for classes where a no argument constructor in the superclass would be needed without losing immutability of classes that may already be in place.  Second, the usage of serialization proxy pattern is completely transparent to the clients of the class, they do not ever need to know that there is a serialization proxy.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23594</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23594"/>
		<updated>2009-10-09T04:57:24Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The idiom for implementing serialization proxy pattern is using an inner class that is declared as private, static, and final.  The reason the class is declared private is because it should not be visible to anyone other then the enclosing class, static is because it should not share any instance variables with the parent, and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Using the serialization proxy pattern brings a two important benefits to the table when dealing with serialization of immutable classes.  First, serialization is made possible for classes where a no argument constructor in the superclass would be needed without losing immutability of classes that may already be in place.  Second, the usage of serialization proxy pattern is completely transparent to the clients of the class, they do not ever need to know that there is a serialization proxy.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23589</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23589"/>
		<updated>2009-10-09T04:53:37Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Serialization Proxy Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The idiom for implementing serialization proxy pattern is using an inner class that is declared as private, static, and final.  The reason the class is declared private is because it should not be visible to anyone other then the enclosing class, static is because it should not share any instance variables with the parent, and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23588</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23588"/>
		<updated>2009-10-09T04:53:19Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Idiomatic Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The idiom for implementing serialization proxy pattern is using an inner class that is declared as private, static, and final.  The reason the class is declared private is because it should not be visible to anyone other then the enclosing class, static is because it should not share any instance variables with the parent, and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23586</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23586"/>
		<updated>2009-10-09T04:52:28Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Idiomatic Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The idiom for implementing serialization proxy pattern is using an inner class that is declared as static and final.  The reason the class is declared static is because it should not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23585</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23585"/>
		<updated>2009-10-09T04:51:35Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it should not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;br /&gt;
&lt;br /&gt;
4. [http://en.wikipedia.org/wiki/Immutable_object Wikipedia - Immutable object]&lt;br /&gt;
&lt;br /&gt;
5. [http://en.wikipedia.org/wiki/Serialization Wikipedia - Serialization]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23582</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23582"/>
		<updated>2009-10-09T04:50:13Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it should not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
1. [http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Java API - Serializable]&lt;br /&gt;
&lt;br /&gt;
2. [http://www.jguru.com/faq/view.jsp?EID=251942 jGuru - Are classes that implement Serializable required to have no-argument constructors?]&lt;br /&gt;
&lt;br /&gt;
3. [http://java.sun.com/docs/books/effective/ Effective Java]&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23566</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23566"/>
		<updated>2009-10-09T04:41:41Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Idiomatic Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it should not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Java API&lt;br /&gt;
Jguru&lt;br /&gt;
Effective Java&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23564</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23564"/>
		<updated>2009-10-09T04:40:15Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Idiomatic Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it does not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  This is a good thing because we don't want users of this class to have to deal with the serialization proxy.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Java API&lt;br /&gt;
Jguru&lt;br /&gt;
Effective Java&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23562</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23562"/>
		<updated>2009-10-09T04:39:22Z</updated>

		<summary type="html">&lt;p&gt;Stphung: /* Serialization Proxy Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it does not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final SerializationProxy implements Serializable {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Java API&lt;br /&gt;
Jguru&lt;br /&gt;
Effective Java&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23557</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 18 i7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_18_i7&amp;diff=23557"/>
		<updated>2009-10-09T04:37:49Z</updated>

		<summary type="html">&lt;p&gt;Stphung: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Serialization Proxy Pattern =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
When designing a class, it is preferred to have them be [http://en.wikipedia.org/wiki/Immutable_object immutable] because of guaranteed thread safety and consistent object state.  An immutable class is one where the state cannot be modified after it is instantiated.&lt;br /&gt;
&lt;br /&gt;
A problem arises in Java when needing a class to be [http://en.wikipedia.org/wiki/Serialization serializable].  In order to have a class be serializable the Serializable interface must be implemented.  A class that is serializable is one that can be represented on disk as a sequence of bits.  The reason this is a problem is not on serialization, but rather on deserialization.  During deserialization of a class, Java requires that the first non-serializable superclass have a no-argument constructor.  Java uses this constructor to instantiate the object and populate the fields.  This may be the case if the superclass is one that is immutable.  The answer here in most cases would be to make the class and superclass mutable and provide a no argument constructor in the superclass.  Serialization proxy pattern aims to solve this problem.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
The idea behind the serialization proxy pattern is simple.  On serialization, instead of having to remove the immutability that exists in the superclass and the class that needs to be serialized, a proxy class is serialized instead of the target class.  A proxy class in this context would be a class where enough information is stored in it to reconstruct the target class.  On deserialization, instead of returning an instance of the proxy class, the target class is instantiated with the information provided by the proxy class and returned in place of it.  The following diagram shows the design of what happens on serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
[[Image:i718design.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
During serialization there is a method that Java looks for which is called writeReplace.  If writeReplace exists, the value returned from this method will be serialized in place of the current class.  This is where we would return a proxy object which stores enough information to reconstruct what we actually want to serialize.  An example of an implementation of writeReplace can be identified in the following code snippet.  In brief, there is a simple class called MyClass which holds a single integer value and there is an inner class SerializationProxy.  The SerializationProxy class used as the serialization proxy object in the writeReplace method when serializing instances of MyClass.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyClass implements Serializable {&lt;br /&gt;
    private final int value;&lt;br /&gt;
    &lt;br /&gt;
    public MyClass(int value) {&lt;br /&gt;
        this.value = value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int getValue() {&lt;br /&gt;
        return this.value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private Object writeReplace() {&lt;br /&gt;
        return new SerializationProxy(this);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private static final class SerializationProxy implements Serializable {&lt;br /&gt;
        private final int value;&lt;br /&gt;
&lt;br /&gt;
        public SerializationProxy(MyClass myClass) {&lt;br /&gt;
            this.value = myClass.getValue();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During deserialization there is a method that Java looks for which is called readResolve.  If readResolve exists, the value returned from this method will instead be the result of the deserialization of this object.  This method would be implemented in the proxy class and the constructor for the class we want to reconstruct would be invoked and returned as the value returned by readResolve.  An example implementation of readResolve would be the following which would be added inside of the SerializationProxy class from the previous example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private Object readResolve() {&lt;br /&gt;
    return new MyClass(this.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idiomatic Usage ==&lt;br /&gt;
The usual way this is implemented is using an inner class that is declared as static and final.  The reason the class is declared static is because it does not share any instance variables with the parent and final because this class should never be extended.  Additionally since the class is hidden because it is an inner class, the serialization proxy used will be transparent to all users of this class regarding serialization.  An example of this structure is the following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
public class B extends A {&lt;br /&gt;
    ...&lt;br /&gt;
    private static final BSerializationProxy {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Java API&lt;br /&gt;
Jguru&lt;br /&gt;
Effective Java&lt;/div&gt;</summary>
		<author><name>Stphung</name></author>
	</entry>
</feed>