<?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=Cwlacewe</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=Cwlacewe"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Cwlacewe"/>
	<updated>2026-05-09T06:03:58Z</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_2007/wiki3_7_cl&amp;diff=10414</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10414"/>
		<updated>2007-11-30T04:15:24Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible. The principle of small interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both. The principle of explicit interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The uniform-access principle is supported by Java, Python Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use. The self-documentation principle is supported by Eiffel. It is difficult to follow this principle in other o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. The single-choice principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10413</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10413"/>
		<updated>2007-11-30T04:12:58Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Uniform-access Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible. The principle of small interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both. The principle of explicit interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The uniform-access principle is supported by Java, Python Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use. The self-documentation principle is supported by Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. The single-choice principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10412</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10412"/>
		<updated>2007-11-30T04:11:56Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible. The principle of small interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both. The principle of explicit interfaces is supported by Java, C++ and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The uniform-access principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use. The self-documentation principle is supported by Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. The single-choice principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10411</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10411"/>
		<updated>2007-11-30T04:10:14Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible. The principle of small interfaces is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both. The principle of explicit interfaces is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The uniform-access principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use. The self-documentation principle is supported by Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. The single-choice principle is supported by Java, Ruby and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10410</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10410"/>
		<updated>2007-11-30T03:41:56Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible. The principle of small interfaces is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both. The principle of explicit interfaces is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The uniform-access principle is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use. The self-documentation principle is supported by Java, and Eiffel. It is not difficult to follow this principle  in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. The single-choice principle is supported by Java, and Eiffel. It is not difficult to follow this principle in any o-o languages.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10409</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10409"/>
		<updated>2007-11-30T03:32:22Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.berenddeboer.net/eiffel/archive/why-eiffel.html Why Eiffel]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10408</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10408"/>
		<updated>2007-11-30T03:29:12Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 indexing&lt;br /&gt;
   description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10407</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10407"/>
		<updated>2007-11-30T03:28:35Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
indexing&lt;br /&gt;
  description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10406</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10406"/>
		<updated>2007-11-30T03:28:19Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&lt;br /&gt;
&lt;br /&gt;
indexing&lt;br /&gt;
  description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10405</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10405"/>
		<updated>2007-11-30T03:27:46Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself. Modules contain canonical minimal and complete documentation on their use.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
Eiffel provides superior support for this through:&lt;br /&gt;
&lt;br /&gt;
Indexing Clauses&lt;br /&gt;
&lt;br /&gt;
Class text begins with an indexing clause that contains a standardized but extensible set of tagged (searchable) lines describing various aspects of the class:&lt;br /&gt;
&lt;br /&gt;
indexing&lt;br /&gt;
&lt;br /&gt;
    description:&lt;br /&gt;
        &amp;quot;Dispensers that provide access to only one item at a time.&amp;quot;&lt;br /&gt;
    status: &amp;quot;Todd Plessel, plessel@vislab.epa.gov&amp;quot;&lt;br /&gt;
    names: &amp;quot;dispenser&amp;quot;&lt;br /&gt;
    representation: &amp;quot;none&amp;quot;&lt;br /&gt;
    access: &amp;quot;fixed&amp;quot;, &amp;quot;membership&amp;quot;&lt;br /&gt;
    contents: &amp;quot;generic&amp;quot;&lt;br /&gt;
    date: &amp;quot;$Date: 1998/02/22 17:00:00 $&amp;quot;&lt;br /&gt;
    revision: &amp;quot;$Revision: 1.0 $&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10390</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10390"/>
		<updated>2007-11-30T02:01:38Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Examples of Single-choice Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &amp;lt;br&amp;gt;&lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.)&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10389</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10389"/>
		<updated>2007-11-30T02:01:14Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
An ATM Example uses a Message class to encapsulate&lt;br /&gt;
details of a Message from a Transaction to the bank. This is used as a&lt;br /&gt;
parameter to the sendMessage() method of NetworkToBank - in place&lt;br /&gt;
of a long list of specific parameters. This means that only the sending&lt;br /&gt;
Transaction and receiving bank need to be aware of the details of the&lt;br /&gt;
structure of a message - not the intermediate class(es) comprising the&lt;br /&gt;
network.&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Examples of Single-choice Principle ====&lt;br /&gt;
Example 1 - Editor: set of commands (insert, delete etc.) &lt;br /&gt;
Example 2 - Graphics system: set of figure types (rectangle, circle etc.) &lt;br /&gt;
Example 3 - Compiler: set of language constructs (instruction, loop, expression etc.) &lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.gordon.edu/local/courses/cs211/lectures-2005/DesignQuality.pdf Design Quality]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.vis.ethz.ch/Zusammenfassung_Software_Architecture Software Architecture]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Explicitinterface.jpg&amp;diff=10374</id>
		<title>File:Explicitinterface.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Explicitinterface.jpg&amp;diff=10374"/>
		<updated>2007-11-29T19:48:59Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10373</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=10373"/>
		<updated>2007-11-29T19:48:33Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
[[Image:explicitinterface.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Example of Single-choice Principle ====&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8841</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8841"/>
		<updated>2007-11-18T00:52:45Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Example of Single-choice Principle ====&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Single_choice_principle Single-Choice Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8839</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8839"/>
		<updated>2007-11-18T00:51:42Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Single-choice Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
The single-choice principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.&lt;br /&gt;
&lt;br /&gt;
====Example of Single-choice Principle ====&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8836</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8836"/>
		<updated>2007-11-18T00:45:43Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Single-choice Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Single-choice Principle ====&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8834</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8834"/>
		<updated>2007-11-18T00:44:05Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Self-documentation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
The designer of a module should strive to make all information about the module part of the module itself.&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8815</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8815"/>
		<updated>2007-11-17T21:31:01Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Uniform-access Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
Note: Even though x is an attribute and x_times_5 is a parameterless method call, they're accessed the same way.&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8813</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8813"/>
		<updated>2007-11-17T21:28:51Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Uniform-access Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
 &lt;br /&gt;
 2&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8811</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8811"/>
		<updated>2007-11-17T21:28:23Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Uniform-access Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
 class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 y = Foo.new(2)&lt;br /&gt;
 puts y.x&lt;br /&gt;
 puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
2&lt;br /&gt;
10&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8809</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8809"/>
		<updated>2007-11-17T21:27:37Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* Example of Uniform-access Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
y = Foo.new(2)&lt;br /&gt;
puts y.x&lt;br /&gt;
puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
2&lt;br /&gt;
10&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8808</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8808"/>
		<updated>2007-11-17T21:26:59Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
The uniform-access principle states that all services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. &lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
Ruby Programming language:&lt;br /&gt;
&lt;br /&gt;
class Foo&lt;br /&gt;
  attr_reader :x&lt;br /&gt;
  def initialize(x)&lt;br /&gt;
    @x = x&lt;br /&gt;
  end&lt;br /&gt;
  def x_times_5&lt;br /&gt;
    return @x*5&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
y = Foo.new(2)&lt;br /&gt;
puts y.x&lt;br /&gt;
puts y.x_times_5&lt;br /&gt;
&lt;br /&gt;
This code outputs:&lt;br /&gt;
2&lt;br /&gt;
10&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Uniform_access_principle Uniform-Access Principle]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8631</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8631"/>
		<updated>2007-11-16T22:03:17Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
The principle of explicit interfaces states that whenever two modules A and B communicate, this must be&lt;br /&gt;
obvious from the text of A or B or both.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8630</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8630"/>
		<updated>2007-11-16T21:57:13Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.  Some of the more important principles are the principle of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle.&lt;br /&gt;
&lt;br /&gt;
===Principle of Small Interfaces ===&lt;br /&gt;
The principle of small interfaces, also known as weak coupling, states that if any two modules communicate at all, they should exchange as&lt;br /&gt;
little information as possible.&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Small Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Principle of Explicit Interfaces ===&lt;br /&gt;
&lt;br /&gt;
====Example of Principle of Explicit Interfaces ====&lt;br /&gt;
&lt;br /&gt;
===Uniform-access Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Uniform-access Principle ====&lt;br /&gt;
&lt;br /&gt;
===Self-documentation Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
===Single-choice Principle ===&lt;br /&gt;
&lt;br /&gt;
====Example of Self-documentation Principle ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.cs.wustl.edu/~levine/courses/cs342/c++/design-principles_4.pdf List of Principles] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8629</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8629"/>
		<updated>2007-11-16T21:37:30Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'' Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bertrand Meyer's Set of Principles ==&lt;br /&gt;
Bertrand Meyer is the developer of the Eiffel programming language.  As a developer, Dr. Meyer participates in the evolution of the Eiffel method and language which includes a set of principles that he developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer Wiki]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8615</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 7 cl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_7_cl&amp;diff=8615"/>
		<updated>2007-11-16T18:43:32Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Bertrand Meyer is a prominent author in o-o design. He has developed a set of principles, many of which are embodied in the Eiffel language. Consider the principles of small interfaces, explicit interfaces, the uniform-access principle, the self-documentation principle, and the single-choice principle. What are good examples of each? Do other languages besides Eiffel support them? Is it difficult to follow these principles in certain o-o languages? '' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=7280</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 10 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=7280"/>
		<updated>2007-10-24T17:14:13Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;==&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages of Inheritance:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages of Inheritance:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;==&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages of Delegation:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages of Delegation: &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Examples of Delegation and Inheritance &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The following section discusses the examples explaining the usage of Inheritance and Delegates and how they can be used in specific situations. Also, it talks about the pros and cons of using these models by taking a common example.&lt;br /&gt;
&lt;br /&gt;
=== Where Delegation makes more sense than Inheritance ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Game Example ====&lt;br /&gt;
&lt;br /&gt;
Consider a game with different difficulty levels. Now suppose we have two kind of player levels smart and dumb. Here the requirement is that it is possible to change the difficulty level of the game at any time. We can construct two models to solve this problem, one with inheritance and the other with delegation.&lt;br /&gt;
&lt;br /&gt;
Inheritance Model&lt;br /&gt;
[[Image:modelA.jpg]]&lt;br /&gt;
&lt;br /&gt;
Delegation Model&lt;br /&gt;
[[Image:modelB.jpg]]&lt;br /&gt;
&lt;br /&gt;
In model A, the client of the computer player much know when to create to create the instances of an appropriate class when switching from difficult to simple mode or vice versa. The trouble here is that in Inheritance, once the object instance is created its type can not be changed at later time.&lt;br /&gt;
Inheritance allows polymorphism, which provides a kind of run-time flexibility, but this model is undesirable. Client code to change the difficulty level at run-time is very complicated, and requires detailed knowledge of the computer player’s implementation classes.&lt;br /&gt;
&lt;br /&gt;
On the other hand in model B, it is possible for class ComputerPlayer to have a simple setDifficulty() method. This can be done using delegation and at runtime using this method we can chance the difficulty level of the game.&lt;br /&gt;
Therefore, delegation is a dynamic relationship, providing a different kind of runtime flexibility in the code, compared to inheritance.&lt;br /&gt;
&lt;br /&gt;
=== Where Inheritance makes more sense than Delegation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== An example ====&lt;br /&gt;
&lt;br /&gt;
Inheritance is generally used when an object derives all of the properties of the base object. This is done at compile time and hence cannot be changed at runtime.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a class&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://media.pragprog.com/titles/pad/CodeAndDebug.pdf Practices of an Agile Developer]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=6835</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 10 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=6835"/>
		<updated>2007-10-23T04:39:18Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;==&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages of Inheritance:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages of Inheritance:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;==&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages of Delegation:&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages of Delegation: &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://media.pragprog.com/titles/pad/CodeAndDebug.pdf Practices of an Agile Developer]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=6809</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 10 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_10_cv&amp;diff=6809"/>
		<updated>2007-10-23T04:11:30Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;==&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;==&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://media.pragprog.com/titles/pad/CodeAndDebug.pdf Practices of an Agile Developer]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6808</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6808"/>
		<updated>2007-10-23T04:11:12Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6797</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6797"/>
		<updated>2007-10-23T03:44:53Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;==&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;==&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://media.pragprog.com/titles/pad/CodeAndDebug.pdf Practices of an Agile Developer]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6796</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6796"/>
		<updated>2007-10-23T03:44:34Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;==&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;==&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;br /&gt;
[http://media.pragprog.com/titles/pad/CodeAndDebug.pdf Practices of an Agile Developer]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6792</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6792"/>
		<updated>2007-10-23T03:38:06Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. MAny programmers are confused on when to use inheritance but inheritance is mainly used when a programmers new class can be used in place of the existing class and the relationship between them can be described as an is-a relationship.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.  It is better to use delegation when a programmers new class needs to use the existing class and the relationship can be described as a has-a or uses-a relationship.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6784</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6784"/>
		<updated>2007-10-23T03:25:42Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6783</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6783"/>
		<updated>2007-10-23T03:24:32Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Straightforward to use &amp;lt;br&amp;gt;&lt;br /&gt;
- Supported by many programming languages &amp;lt;br&amp;gt;&lt;br /&gt;
- Easy to implement new functionality &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance: &amp;lt;br&amp;gt;&lt;br /&gt;
- Exposes a subclass to the details of its parent class &amp;lt;br&amp;gt;&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation: &amp;lt;br&amp;gt;&lt;br /&gt;
- Is efficient since objects are encapsulated &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6776</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6776"/>
		<updated>2007-10-23T03:13:24Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;===&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Inheritance&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Inheritance: &lt;br /&gt;
- Straightforward to use&lt;br /&gt;
- Supported by many programming languages&lt;br /&gt;
- Easy to implement new functionality&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Inheritance:&lt;br /&gt;
- Exposes a subclass to the details of its parent class&lt;br /&gt;
- Changes in the parent class implementation would cause the subclass to change as well&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Delegation&amp;lt;/b&amp;gt;===&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Advantages and Disadvantages of Delegation&amp;lt;/b&amp;gt;====&lt;br /&gt;
Advantages of Delegation:&lt;br /&gt;
- Provides flexibility due to the fact that any object can be replaced at run time by another one of the same type&lt;br /&gt;
&lt;br /&gt;
Disadvantages of Delegation:&lt;br /&gt;
- Is efficient since objects are encapsulated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6760</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6760"/>
		<updated>2007-10-23T02:33:30Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program.  &lt;br /&gt;
&lt;br /&gt;
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6757</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6757"/>
		<updated>2007-10-23T02:24:01Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Inheritance is a way to form new classes in object oriented programming using already defined classes.  Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6754</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6754"/>
		<updated>2007-10-23T02:10:21Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6753</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6753"/>
		<updated>2007-10-23T02:09:41Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; References &amp;lt;/b&amp;gt; ==&lt;br /&gt;
[users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6741</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6741"/>
		<updated>2007-10-23T01:53:56Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6739</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 9 cv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_9_cv&amp;diff=6739"/>
		<updated>2007-10-23T01:52:40Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.'' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt; Inheritance vs. Delegation &amp;lt;/b&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5475</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5475"/>
		<updated>2007-10-11T00:43:38Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton Pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
&amp;lt;b&amp;gt;Head First Design Patterns&amp;lt;/b&amp;gt; by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series)&amp;lt;/b&amp;gt; by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://c2.com/cgi/wiki?SingletonPattern Singleton Article]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5474</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5474"/>
		<updated>2007-10-11T00:42:29Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton Pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
&amp;lt;b&amp;gt;Head First Design Patterns&amp;lt;/b&amp;gt; by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series)&amp;lt;/b&amp;gt; by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.mrchucho.net/index.php/archives/2006/10/ Singleton Article]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5473</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5473"/>
		<updated>2007-10-11T00:42:02Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton Pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
&amp;lt;b&amp;gt;Head First Design Patterns&amp;lt;/b&amp;gt; by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series)&amp;lt;/b&amp;gt; by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki]&lt;br /&gt;
[http://www.mrchucho.net/index.php/archives/2006/10/ Singleton Article]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5471</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5471"/>
		<updated>2007-10-11T00:40:19Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton Pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
&amp;lt;b&amp;gt;Head First Design Patterns&amp;lt;/b&amp;gt; by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series)&amp;lt;/b&amp;gt; by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5454</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5454"/>
		<updated>2007-10-10T23:22:01Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
&amp;lt;b&amp;gt;Head First Design Patterns&amp;lt;/b&amp;gt; by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series)&amp;lt;/b&amp;gt; by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5453</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5453"/>
		<updated>2007-10-10T23:20:57Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: /* &amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  When programming, one should not think that the use of Singleton Pattern would solve problems that are associated with global variables because this is a common mistake.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;or consider simpler implementation in Java,&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Head First Design Patterns by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series) by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5329</id>
		<title>CSC/ECE 517 Fall 2007/wiki1b 6 c1</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki1b_6_c1&amp;diff=5329"/>
		<updated>2007-10-10T17:40:16Z</updated>

		<summary type="html">&lt;p&gt;Cwlacewe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take a case of the Singleton pattern and implement it as succinctly as possible in Ruby and Java. Compare the two implementations in terms of clarity and succinctness. The example should be a &amp;quot;real-world&amp;quot; example. While it may be grossly oversimplified for the purpose of illustration, it should not be totally contrived.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Singleton Pattern&amp;lt;/b&amp;gt; ==&lt;br /&gt;
The Singleton pattern is a design pattern used to insure the existence of a single instance of a class in the run time. It constructs the object once and returns a reference to this object every time thereafter. In a multithreading environment, special care should be taken.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Global Variables versus Singleton&amp;lt;/b&amp;gt;===&lt;br /&gt;
Singletons are often mistaken as global variables.  These two are very similar but the main difference between the two is that the Singleton Pattern deals with how to limit instances, while global variables deal with how programmers declare instances.  Singletons are frequently mistaken by programmers that are inexperienced because they usually think that the use of Singleton Pattern will solve problems that are associated with global variables.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Benefits of Singleton Pattern&amp;lt;/b&amp;gt;===&lt;br /&gt;
There are benefits of using the singleton pattern over other patterns and global variables.  When using Singleton Pattern it allows instance control by preventing other objects from instantiating their own copies of the Singleton object which would ensure that all objects access the single instance.  Using the Singleton Pattern also gives a little flexibility since the class controls the instantiation process and has the flexibility to change the instantiation process. Singleton Pattern allows reduced name space because the Singleton class can be subclassed,which makes it easier to configure an application with an instance of this extended class. The application can be configures with an instance of the class one needs at run-time. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Several uses of Singleton Pattern include logger (which is illustrated below), payment form, application preference, many dialogs in GUI environemt, and etc.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Class Diagram&amp;lt;/b&amp;gt;==&lt;br /&gt;
[[Image:singleton.png]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Implementation&amp;lt;/b&amp;gt; ==&lt;br /&gt;
To implement Singleton do following steps&amp;lt;br&amp;gt;&lt;br /&gt;
1-	Turn your class constructor to private&amp;lt;br&amp;gt;&lt;br /&gt;
2-	Create a public method -getInstance()- to return a refrence to the instance. If the object is not initialized yet (object == null) it will create one by invoking the constructor.&amp;lt;br&amp;gt;&lt;br /&gt;
3-	In multithreading environment, synchoranize your getInstance() method so you don't end with Doubleton or Tripleton.&amp;lt;br&amp;gt; &lt;br /&gt;
4-	Consider overiding the clone method in Java, so no one can copy your Singleton.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In multithreading environment, a synchronized command should be used so not every thread in the program can initialize its own instance of the singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Example Implementations&amp;lt;/b&amp;gt; ===&lt;br /&gt;
To demonstrate further let us consider programs that implement a logger in Java and then in Ruby. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private static LoggerSingleton instance = null;&lt;br /&gt;
   private LoggerSingleton() {&lt;br /&gt;
      // Exists only to defeat instantiation.&lt;br /&gt;
   }&lt;br /&gt;
   public static synchronized LoggerSingleton getInstance() {&lt;br /&gt;
      if(instance == null) {&lt;br /&gt;
         instance = new LoggerSingleton();&lt;br /&gt;
      }&lt;br /&gt;
      return instance;&lt;br /&gt;
   }&lt;br /&gt;
   public Object clone() throws CloneNotSupportedException {&lt;br /&gt;
    	throw new CloneNotSupportedException(); &lt;br /&gt;
   }&lt;br /&gt;
   // add other attributes&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or consider simpler implementation in Java,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public class LoggerSingleton {&lt;br /&gt;
   private final static LoggerSingleton instance = new Singleton();&lt;br /&gt;
 &lt;br /&gt;
   private LoggerSingleton () {&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   public static LoggerSingleton getInstance() {&lt;br /&gt;
     return instance ;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or for sure the super simple in Ruby,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 require 'singleton' &lt;br /&gt;
 class LoggerSingleton&lt;br /&gt;
   include Singleton &lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Invoking Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to invoke a singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 LoggerSingleton logger1 = LoggerSingleton.getInstance();	&lt;br /&gt;
 LoggerSingleton logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
 LoggerSingleton logger3 = new LoggerSingleton(); // compilation error will occur; The constructor is private.&lt;br /&gt;
 System.out.println(logger1);&lt;br /&gt;
 System.out.println(logger2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 logger1 = LoggerSingleton.instance &lt;br /&gt;
 logger2 = LoggerSingleton.instance &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt;Test Singletons&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The following coding is to test singleton class in Java then in Ruby&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 import junit.framework.Assert; &lt;br /&gt;
 import junit.framework.TestCase; &lt;br /&gt;
 public class TestSingleton extends TestCase {&lt;br /&gt;
  private LoggerSingleton logger1 = null, logger2 = null;&lt;br /&gt;
  public TestSingleton(String name) {&lt;br /&gt;
    super(name);&lt;br /&gt;
  }&lt;br /&gt;
  public void setUp() {&lt;br /&gt;
        logger1 = LoggerSingleton.getInstance();&lt;br /&gt;
        logger2 = LoggerSingleton.getInstance();&lt;br /&gt;
   }&lt;br /&gt;
  public void testUnique() {&lt;br /&gt;
        System.out.println(logger1);&lt;br /&gt;
        System.out.println(logger2);&lt;br /&gt;
        Assert.assertEquals(true, logger1 == logger2);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 def testSingleton&lt;br /&gt;
    logger1 = LoggerSingleton.instance &lt;br /&gt;
    logger2 = LoggerSingleton.instance &lt;br /&gt;
    assertEqual logger1, logger2&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Comparison&amp;lt;/b&amp;gt; ==&lt;br /&gt;
When comparing Singleton Pattern in Java and Ruby, it is shown that Ruby obviously is better than Java. It seems that Ruby would win because of the simplicity compared to Java since only one line of code &amp;quot;include Singleton&amp;quot; enables all the functionalities when Java needs more lines to do this.  Since Ruby uses singleton mixins, it is easier to implemenet and since Java does not use mixins, it requires  more implementation in the coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Java doesn’t contain singleton pattern in the language itself, although implementation for the pattern is still possible. While in Ruby the singleton pattern is in the language itself, which became possible since Ruby is a dynamic language through singleton module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;b&amp;gt;References&amp;lt;/b&amp;gt; ==&lt;br /&gt;
Head First Design Patterns by Eric Freeman, Kathy Sierra, Bert Bates, Elisabeth Freeman &amp;lt;br&amp;gt;&lt;br /&gt;
Programming Ruby: The Pragmatic Programmers' Guide (Pragmatic Programmers Series) by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;External Links&amp;lt;/b&amp;gt; ===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern Wiki]&lt;/div&gt;</summary>
		<author><name>Cwlacewe</name></author>
	</entry>
</feed>