<?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=NCS</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=NCS"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/NCS"/>
	<updated>2026-08-13T12:10:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27813</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27813"/>
		<updated>2009-11-18T01:53:46Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Composability Composability and Decomposability]== &lt;br /&gt;
Using simple interfaces to define behaviors helps us break the program down to smaller pieces that are easier to understand and manage. This also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us in the following ways&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;br /&gt;
* [http://www.uta.edu/cse/levine/fall99/cse5324/senotes3.pdf Software Engineering Analysis, Design, Creation]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27808</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27808"/>
		<updated>2009-11-18T01:49:30Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Continuity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Composability Composability and Decomposability]== &lt;br /&gt;
Using simple interfaces to define behaviors helps us break the program down to smaller pieces that are easier to understand and manage. This also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us in the following ways&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27806</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27806"/>
		<updated>2009-11-18T01:49:04Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Understandability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Composability Composability and Decomposability]== &lt;br /&gt;
Using simple interfaces to define behaviors helps us break the program down to smaller pieces that are easier to understand and manage. This also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us in the following ways&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27799</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27799"/>
		<updated>2009-11-18T01:46:32Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Composability and Decomposability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Composability Composability and Decomposability]== &lt;br /&gt;
Using simple interfaces to define behaviors helps us break the program down to smaller pieces that are easier to understand and manage. This also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us in the following ways&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27779</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27779"/>
		<updated>2009-11-18T01:40:10Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. Using simple interfaces to define behaviors also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us in the following ways&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27777</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27777"/>
		<updated>2009-11-18T01:39:48Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. Using simple interfaces to define behaviors also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle of explicit interfaces helps us&lt;br /&gt;
* Decomposability - helps us make easier subprograms&lt;br /&gt;
* Composability - helps reuse of code&lt;br /&gt;
* Understandability - makes it easier and helps us better understand the programs&lt;br /&gt;
* Continuity - improves coupling&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27776</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27776"/>
		<updated>2009-11-18T01:37:25Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Not really any */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. Using simple interfaces to define behaviors also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense probably a specialized object with a specialized behavior that doesn't really make sense to be defined as an interface. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class LocalGreeter {&lt;br /&gt;
   public void greet () {&lt;br /&gt;
      System.out.println (Localizer.getLocalized(&amp;quot;hello&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We could define a greeter interface but then we don't see any reuse for it.&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27765</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27765"/>
		<updated>2009-11-18T01:27:45Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Composability and Decomposability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with the specifications and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. Using simple interfaces to define behaviors also allows us to share this behavior across different classes there by increasing code reuseability. And since these behaviors are well understood it is easy to understand the behavior of objects that implement these behaviors.&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27760</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27760"/>
		<updated>2009-11-18T01:23:17Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Interface (Implicit vs Explicit) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects. For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. &lt;br /&gt;
&lt;br /&gt;
For example If we wish to implement the behavior of automobile we could let each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27758</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27758"/>
		<updated>2009-11-18T01:21:52Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Interface_(computer_science) interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27757</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27757"/>
		<updated>2009-11-18T01:20:17Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/interface interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27755</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27755"/>
		<updated>2009-11-18T01:19:03Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Bertrand_Meyer Bertrand Meyer]'s principle of explicit [http://en.wikipedia.org/wiki/Bertrand_Meyer interface] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27754</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27754"/>
		<updated>2009-11-18T01:17:46Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[[Bertrand Meyer]]'s principle of explicit [[interface]] states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27752</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27752"/>
		<updated>2009-11-18T01:12:22Z</updated>

		<summary type="html">&lt;p&gt;NCS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Bertrand Meyer's principle of explicit interface states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
* [http://www.eoinwoods.info/doc/spa2009_patterns_session.pdf Design Principles Mining Pattern DNA]&lt;br /&gt;
* [http://se.ethz.ch/~meyer/publications/acm/eiffel_sigplan.pdf PROGRAMMING FOR REUSABILITY AND EXTENDIBILITY]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27168</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27168"/>
		<updated>2009-11-17T01:33:45Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Code example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Bertrand Meyer's principle of explicit interface states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Automobile {&lt;br /&gt;
 &lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface Autospec{&lt;br /&gt;
&lt;br /&gt;
	public String getMake();&lt;br /&gt;
&lt;br /&gt;
	public String getModel();&lt;br /&gt;
&lt;br /&gt;
	public String getYear();&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
&lt;br /&gt;
	public void turn();&lt;br /&gt;
&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
&lt;br /&gt;
	public void stop();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27162</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27162"/>
		<updated>2009-11-17T01:25:12Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Code example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Bertrand Meyer's principle of explicit interface states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the Automobile class. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class Automobile {&lt;br /&gt;
        public Automobile () {}&lt;br /&gt;
	public String getMake() {}&lt;br /&gt;
	public String getModel() {}&lt;br /&gt;
	public String getYear() {}&lt;br /&gt;
	public String getLicensePlate() {}&lt;br /&gt;
	public String getLicenseExpiration() {}&lt;br /&gt;
&lt;br /&gt;
	public void turn() {}&lt;br /&gt;
	public void accelerate() {}&lt;br /&gt;
	public void stop() {}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed() {}&lt;br /&gt;
	public String getRPM() {}&lt;br /&gt;
	public String getFuelLevel() {}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
interface Autospec{&lt;br /&gt;
	public String getMake();&lt;br /&gt;
	public String getModel();&lt;br /&gt;
	public String getYear();&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface OperateAuto {&lt;br /&gt;
	public void turn();&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
	public void stop();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface AutoDashboard{&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27146</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_13_ncs&amp;diff=27146"/>
		<updated>2009-11-17T01:04:26Z</updated>

		<summary type="html">&lt;p&gt;NCS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Bertrand Meyer's principle of explicit interface states that when 2 modules A and B communicate, this must be obvious from the text of A or B or both. &lt;br /&gt;
&lt;br /&gt;
In this article we will consider the Pro's and cons of this approach. When it does and does not make sense to follow this principle.&lt;br /&gt;
&lt;br /&gt;
= Interface (Implicit vs Explicit)=&lt;br /&gt;
A generic definition of an interface in programming context can be defined as a set of methods exposed that can be invoked by other objects.&lt;br /&gt;
&lt;br /&gt;
For most object oriented languages all protected and public methods of the Object will constitute to be the Object's interface.&lt;br /&gt;
&lt;br /&gt;
Most object oriented languages provide a means to specify a specific behavior that the objects can implement. For example If we wish to implement the behavior of automobile we could let &lt;br /&gt;
&lt;br /&gt;
each class that is an automobile have all the methods implemented without using an explicit interface or have a formal explicit interface defined that defines the automobile behavior &lt;br /&gt;
&lt;br /&gt;
and have each automobile object implement the well defined Automobile interface.&lt;br /&gt;
&lt;br /&gt;
== Code example ==&lt;br /&gt;
&lt;br /&gt;
Let us consider the automobiles car and truck. We can either define all the shared methods and behaviors implicitly as methods within the class &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class Automobile {&lt;br /&gt;
	public String getMake() {...}&lt;br /&gt;
	public String getModel() {...}&lt;br /&gt;
	public String getYear() {...}&lt;br /&gt;
	public String getLicensePlate() {...}&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively define behaviors explicitly and have the car and truck class implement them. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
public interface Autospec{&lt;br /&gt;
	public String getMake();&lt;br /&gt;
	public String getModel();&lt;br /&gt;
	public String getYear();&lt;br /&gt;
	public String getLicensePlate();&lt;br /&gt;
	public String getLicenseExpiration();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public interface OperateAuto {&lt;br /&gt;
	public void turn();&lt;br /&gt;
	public void accelerate();&lt;br /&gt;
	public void stop();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public interface AutoDashboard{&lt;br /&gt;
	public String getSpeed();&lt;br /&gt;
	public String getRPM();&lt;br /&gt;
	public String getFuelLevel();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Automobile implements Autospec, OperateAuto, AutoDashboard{&lt;br /&gt;
	// AutoSpec&lt;br /&gt;
	public String getMake(){...}&lt;br /&gt;
	public String getModel(){...}&lt;br /&gt;
	public String getYear(){...}&lt;br /&gt;
	public String getOwner() {...}&lt;br /&gt;
	public String getLicensePlate(){...}&lt;br /&gt;
	public String getLicenseExpiration(){...}&lt;br /&gt;
&lt;br /&gt;
	// OperateAuto&lt;br /&gt;
	public void turn(){...}&lt;br /&gt;
	public void accelerate(){...}&lt;br /&gt;
	public void stop(){...}&lt;br /&gt;
&lt;br /&gt;
	// AutoDash&lt;br /&gt;
	public String getSpeed(){...}&lt;br /&gt;
	public String getRPM(){...}&lt;br /&gt;
	public String getFuelLevel(){...}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Advantages of using explicit interface =&lt;br /&gt;
Let us consider the advantages of having explicit interfaces&lt;br /&gt;
&lt;br /&gt;
== Understandability ==&lt;br /&gt;
The behaviors are well understood and helps us understand the functionality as a set of smaller related operations. By documenting the behaviors it is easier to understand each set and &lt;br /&gt;
&lt;br /&gt;
the behavior individually and it is clear by looking at the Auto class that it implements these behavior. The interface exposed by the auto class can be easily understood.&lt;br /&gt;
&lt;br /&gt;
== Continuity ==&lt;br /&gt;
It is very easy to find the elements that a potential change can effect. In our example above if we have explicit interfaces to determine the impact of change in any of the interface &lt;br /&gt;
&lt;br /&gt;
methods or modifying an interface itself can be easily determined by the determining the sets of elements that either implement the interface or invoke it.&lt;br /&gt;
&lt;br /&gt;
== Composability and Decomposability ==&lt;br /&gt;
It is easy to determine the impact if we have the need to decompose a module further. For example if we feel the need to split the specification interface into two one that deals with &lt;br /&gt;
&lt;br /&gt;
the specs and the other that deals with DMV then any and all outside dependencies are clearly visible. We simply need to look at elements that use the Autospec interface only. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Disadvantages of using explicit interfaces =&lt;br /&gt;
== Not really any ==&lt;br /&gt;
The only case it might not make sense is if the class itself has only one &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
Bertrand Meyer's principle does help us understand the code better and makes it easier to identify the impacted elements much more easily if there are any changes in the interface or we intend to compose or decompose the objects in smaller pieces.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=25838</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=25838"/>
		<updated>2009-10-14T01:21:27Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Iterators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Ruby_language Ruby] offers more concise implementations of certain [http://en.wikipedia.org/wiki/Design_pattern design patterns] than [http://en.wikipedia.org/wiki/Java_language Java] does. We will look at some design patterns and compare the implementation in '''Ruby vs Java''' with the goal to answer the following:&lt;br /&gt;
* Is this typical of [http://en.wikipedia.org/wiki/Dynamic_language dynamic] object-oriented languages?&lt;br /&gt;
&lt;br /&gt;
* Are there design patterns that any dynamically typed language can realize better than a statically typed language?&lt;br /&gt;
&lt;br /&gt;
* Are there instances when a different pattern should be used in a dynamic language than a static language?&lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton pattern] is a design pattern used to restrict the instantiation of the class to one object. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves:&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
Below is the comparison between singleton class written in Java and Ruby. &lt;br /&gt;
&lt;br /&gt;
It is clear that Ruby provides a more concise way of implementing the singleton pattern. Ruby uses the singleton module which automatically provides all the functionality that we need to write manually in Java. By writing &amp;quot;include singleton&amp;quot; in Ruby, we prevent ourselves from having to repeat writing the same code for each class that we wish to make singleton. In contrast, we need to write the Java class below for every singleton objects we create. &lt;br /&gt;
&lt;br /&gt;
'''Java'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample { &lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonEx; &lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample() {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonEx == null) {&lt;br /&gt;
          singletonEx = new SingletonExample();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonEx;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Ruby''' (using singleton module)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in Ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby lets us redefine the new method and this allows us to implement the Factory pattern with a class that looks very much like an ordinary class. The client does not need to know about the special createObject methods.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential object in the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection and cast the objects to the right type to use them whereas in Ruby iterators are built right in. Here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific pattern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support meta-programming and reflection via Modules and Mixins and support extending/reopening classes and redefining methods at run time definitely make it easier to implement patterns with fewer lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot; statement. You can make factories that look exactly like ordinary classes. These features in Ruby do make implementing design patterns very easy and let a programmer focus on solving the problem at hand rather than spending time implementing the design patterns.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=25837</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=25837"/>
		<updated>2009-10-14T01:21:04Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Ruby_language Ruby] offers more concise implementations of certain [http://en.wikipedia.org/wiki/Design_pattern design patterns] than [http://en.wikipedia.org/wiki/Java_language Java] does. We will look at some design patterns and compare the implementation in '''Ruby vs Java''' with the goal to answer the following:&lt;br /&gt;
* Is this typical of [http://en.wikipedia.org/wiki/Dynamic_language dynamic] object-oriented languages?&lt;br /&gt;
&lt;br /&gt;
* Are there design patterns that any dynamically typed language can realize better than a statically typed language?&lt;br /&gt;
&lt;br /&gt;
* Are there instances when a different pattern should be used in a dynamic language than a static language?&lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern Singleton pattern] is a design pattern used to restrict the instantiation of the class to one object. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves:&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
Below is the comparison between singleton class written in Java and Ruby. &lt;br /&gt;
&lt;br /&gt;
It is clear that Ruby provides a more concise way of implementing the singleton pattern. Ruby uses the singleton module which automatically provides all the functionality that we need to write manually in Java. By writing &amp;quot;include singleton&amp;quot; in Ruby, we prevent ourselves from having to repeat writing the same code for each class that we wish to make singleton. In contrast, we need to write the Java class below for every singleton objects we create. &lt;br /&gt;
&lt;br /&gt;
'''Java'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample { &lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonEx; &lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample() {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonEx == null) {&lt;br /&gt;
          singletonEx = new SingletonExample();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonEx;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Ruby''' (using singleton module)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in Ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby lets us redefine the new method and this allows us to implement the Factory pattern with a class that looks very much like an ordinary class. The client does not need to know about the special createObject methods.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection and cast the objects to the right type to use them whereas in Ruby iterators are built right in. Here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific pattern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support meta-programming and reflection via Modules and Mixins and support extending/reopening classes and redefining methods at run time definitely make it easier to implement patterns with fewer lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot; statement. You can make factories that look exactly like ordinary classes. These features in Ruby do make implementing design patterns very easy and let a programmer focus on solving the problem at hand rather than spending time implementing the design patterns.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23278</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23278"/>
		<updated>2009-10-09T00:25:17Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Singleton pattern is used when we wish to restict the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Singleton Class example in JAVA&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample {&lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonExample;&lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample () {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonExample == null) {&lt;br /&gt;
          singletonExample = new SingletonExample ();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonExample ;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In JAVA we would need to take the above steps for every class that we want to make singleton.&lt;br /&gt;
&lt;br /&gt;
In ruby we can do what we did in JAVA above or simply use the singleton module that automatically gets us the functionality listed above.&lt;br /&gt;
&lt;br /&gt;
Singleton example in Ruby using the singleton module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  Class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby provides a more concise way of implementing the singleton pattern and prevents us from havin to repeat ourselves for each class that we wish to make singleton. We can simply include the singleton module. In JAVA we will have to repeat the code from the JAVA example for each class we wish to make singleton.&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in Ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby lets us redefine the new method and this allows us to implement the Factory pattern with a class that looks very much like an ordinary class. The client does not need to know about the special createObject methods.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection and cast the objects to the right type to use them whereas in Ruby iterators are built right in. Here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with fewer lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot; statement. You can make factories that look exactly like ordinary classes. These features in Ruby do make implementing design patterns very easy and let a programmer focus on soving the problem at hand rather than spending time implementing the design patterns.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23274</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23274"/>
		<updated>2009-10-09T00:22:36Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Iterators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Singleton pattern is used when we wish to restict the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Singleton Class example in JAVA&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample {&lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonExample;&lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample () {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonExample == null) {&lt;br /&gt;
          singletonExample = new SingletonExample ();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonExample ;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In JAVA we would need to take the above steps for every class that we want to make singleton.&lt;br /&gt;
&lt;br /&gt;
In ruby we can do what we did in JAVA above or simply use the singleton module that automatically gets us the functionality listed above.&lt;br /&gt;
&lt;br /&gt;
Singleton example in Ruby using the singleton module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  Class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby provides a more concise way of implementing the singleton pattern and prevents us from havin to repeat ourselves for each class that we wish to make singleton. We can simply include the singleton module. In JAVA we will have to repeat the code from the JAVA example for each class we wish to make singleton.&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in Ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby lets us redefine the new method and this allows us to implement the Factory pattern with a class that looks very much like an ordinary class. The client does not need to know about the special createObject methods.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection and cast the objects to the right type to use them whereas in Ruby iterators are built right in. Here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23266</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23266"/>
		<updated>2009-10-09T00:18:39Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Factory Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Singleton pattern is used when we wish to restict the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Singleton Class example in JAVA&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample {&lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonExample;&lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample () {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonExample == null) {&lt;br /&gt;
          singletonExample = new SingletonExample ();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonExample ;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In JAVA we would need to take the above steps for every class that we want to make singleton.&lt;br /&gt;
&lt;br /&gt;
In ruby we can do what we did in JAVA above or simply use the singleton module that automatically gets us the functionality listed above.&lt;br /&gt;
&lt;br /&gt;
Singleton example in Ruby using the singleton module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  Class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby provides a more concise way of implementing the singleton pattern and prevents us from havin to repeat ourselves for each class that we wish to make singleton. We can simply include the singleton module. In JAVA we will have to repeat the code from the JAVA example for each class we wish to make singleton.&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in Ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby lets us redefine the new method and this allows us to implement the Factory pattern with a class that looks very much like an ordinary class. The client does not need to know about the special createObject methods.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23262</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23262"/>
		<updated>2009-10-09T00:15:32Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Singleton Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Singleton pattern is used when we wish to restict the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Singleton Class example in JAVA&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample {&lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonExample;&lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample () {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonExample == null) {&lt;br /&gt;
          singletonExample = new SingletonExample ();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonExample ;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In JAVA we would need to take the above steps for every class that we want to make singleton.&lt;br /&gt;
&lt;br /&gt;
In ruby we can do what we did in JAVA above or simply use the singleton module that automatically gets us the functionality listed above.&lt;br /&gt;
&lt;br /&gt;
Singleton example in Ruby using the singleton module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  Class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ruby provides a more concise way of implementing the singleton pattern and prevents us from havin to repeat ourselves for each class that we wish to make singleton. We can simply include the singleton module. In JAVA we will have to repeat the code from the JAVA example for each class we wish to make singleton.&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23255</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23255"/>
		<updated>2009-10-09T00:12:24Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Singleton Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Singleton pattern is used when we wish to restict the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern involves&lt;br /&gt;
* making the constructor private &lt;br /&gt;
* declare a instance variable &lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Singleton Class example in JAVA&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  public class SingletonExample {&lt;br /&gt;
     // declare instance variable&lt;br /&gt;
     private static SingletonExample singletonExample;&lt;br /&gt;
     // Make the constructor is private&lt;br /&gt;
     private SingletonExample () {&lt;br /&gt;
     }&lt;br /&gt;
     // make this thread safe use synchronize&lt;br /&gt;
     synchronize public static SingletonExample getSingletonObject() {&lt;br /&gt;
       if (singletonExample == null) {&lt;br /&gt;
          singletonExample = new SingletonExample ();&lt;br /&gt;
       }&lt;br /&gt;
       return singletonExample ;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In JAVA we would need to take the above steps for every class that we want to make singleton.&lt;br /&gt;
&lt;br /&gt;
In ruby we can do what we did in JAVA above or simply use the singleton module that automatically gets us the functionality listed above.&lt;br /&gt;
&lt;br /&gt;
Singleton example in Ruby using the singleton module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  require singleton&lt;br /&gt;
  Class SingletonExample&lt;br /&gt;
    include singleton&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23243</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23243"/>
		<updated>2009-10-08T23:55:34Z</updated>

		<summary type="html">&lt;p&gt;NCS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns in JAVA vs Ruby=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Resticting the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern in JAV And Ruby is identical. We need to &lt;br /&gt;
&lt;br /&gt;
* make the constructor private &lt;br /&gt;
&lt;br /&gt;
* declare a instance variable &lt;br /&gt;
&lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However in JAVA we would need to redo these steps for all classes that we want to be singleton whereas in Ruby we can simply include the singleton module that automatically gets us the functionality listed above. &lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  interface IObjectFactory {&lt;br /&gt;
     IGear createObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
  IObject createObject() {&lt;br /&gt;
     if ( some condition )&lt;br /&gt;
        return new XObject();&lt;br /&gt;
     else&lt;br /&gt;
        return new YObject();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser {&lt;br /&gt;
     public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
        IObject my_Object = factory.createObject();&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
    def new() &lt;br /&gt;
      if ( ... some condition )&lt;br /&gt;
         return XObject.new()&lt;br /&gt;
      else&lt;br /&gt;
         return YObject().new()&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  class ObjectUser &lt;br /&gt;
    def doSomething(factory )&lt;br /&gt;
      ...&lt;br /&gt;
      my_object = factory.new()&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  a = [ 10, 20, 30, 40 ]&lt;br /&gt;
  a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
  open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23217</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23217"/>
		<updated>2009-10-08T23:26:00Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Factory Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns Analysis=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Resticting the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern in JAV And Ruby is identical. We need to &lt;br /&gt;
&lt;br /&gt;
* make the constructor private &lt;br /&gt;
&lt;br /&gt;
* declare a instance variable &lt;br /&gt;
&lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;todo&amp;gt; JAVA and ruby singletone examples here. &amp;lt;/todo&amp;gt; &lt;br /&gt;
&lt;br /&gt;
However in JAVA we would need to redo these steps for all classes that we want to be singleton whereas in Ruby we can simply include the singleton module that automatically gets us the functionality listed above. &lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface IObjectFactory {&lt;br /&gt;
&lt;br /&gt;
IGear createObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
&lt;br /&gt;
IObject createObject() {&lt;br /&gt;
&lt;br /&gt;
if ( some condition )&lt;br /&gt;
&lt;br /&gt;
return new XObject();&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return new YObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ObjectUser {&lt;br /&gt;
&lt;br /&gt;
public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IObject my_Object = factory.createObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
def new() &lt;br /&gt;
&lt;br /&gt;
if ( ... some condition )&lt;br /&gt;
&lt;br /&gt;
return XObject.new()&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return YObject().new()&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectUser &lt;br /&gt;
&lt;br /&gt;
def doSomething(factory )&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_object = factory.new()&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Iterators= Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
a = [ 10, 20, 30, 40 ]&lt;br /&gt;
&lt;br /&gt;
a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;TODO&amp;gt; Some more patterns&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23215</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23215"/>
		<updated>2009-10-08T23:22:31Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Factory Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns Analysis=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Resticting the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern in JAV And Ruby is identical. We need to &lt;br /&gt;
&lt;br /&gt;
* make the constructor private &lt;br /&gt;
&lt;br /&gt;
* declare a instance variable &lt;br /&gt;
&lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;todo&amp;gt; JAVA and ruby singletone examples here. &amp;lt;/todo&amp;gt; &lt;br /&gt;
&lt;br /&gt;
However in JAVA we would need to redo these steps for all classes that we want to be singleton whereas in Ruby we can simply include the singleton module that automatically gets us the functionality listed above. &lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;JAVA&amp;quot;&amp;gt;&lt;br /&gt;
interface IObjectFactory {&lt;br /&gt;
&lt;br /&gt;
IGear createObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
&lt;br /&gt;
IObject createObject() {&lt;br /&gt;
&lt;br /&gt;
if ( ... some condition... )&lt;br /&gt;
&lt;br /&gt;
return new XObject();&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return new YObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ObjectUser {&lt;br /&gt;
&lt;br /&gt;
public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
IObject my_Object = factory.createObject();&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
def new() &lt;br /&gt;
&lt;br /&gt;
if ( ... some condition )&lt;br /&gt;
&lt;br /&gt;
return XObject.new()&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return YObject().new()&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectUser &lt;br /&gt;
&lt;br /&gt;
def doSomething(factory )&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_object = factory.new()&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Iterators= Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
a = [ 10, 20, 30, 40 ]&lt;br /&gt;
&lt;br /&gt;
a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;TODO&amp;gt; Some more patterns&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23213</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23213"/>
		<updated>2009-10-08T23:21:15Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Factory Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns Analysis=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Resticting the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern in JAV And Ruby is identical. We need to &lt;br /&gt;
&lt;br /&gt;
* make the constructor private &lt;br /&gt;
&lt;br /&gt;
* declare a instance variable &lt;br /&gt;
&lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;todo&amp;gt; JAVA and ruby singletone examples here. &amp;lt;/todo&amp;gt; &lt;br /&gt;
&lt;br /&gt;
However in JAVA we would need to redo these steps for all classes that we want to be singleton whereas in Ruby we can simply include the singleton module that automatically gets us the functionality listed above. &lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&amp;lt;source lang=&amp;quot;JAVA&amp;quot;&amp;gt;&lt;br /&gt;
interface IObjectFactory {&lt;br /&gt;
&lt;br /&gt;
IGear createObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
&lt;br /&gt;
IObject createObject() {&lt;br /&gt;
&lt;br /&gt;
if ( ... some condition... )&lt;br /&gt;
&lt;br /&gt;
return new XObject();&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return new YObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ObjectUser {&lt;br /&gt;
&lt;br /&gt;
public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
IObject my_Object = factory.createObject();&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
def new() &lt;br /&gt;
&lt;br /&gt;
if ( ... some condition )&lt;br /&gt;
&lt;br /&gt;
return XObject.new()&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return YObject().new()&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Ruby&amp;quot;&amp;gt;&lt;br /&gt;
class ObjectUser &lt;br /&gt;
&lt;br /&gt;
def doSomething(factory )&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_object = factory.new()&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Iterators= Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
a = [ 10, 20, 30, 40 ]&lt;br /&gt;
&lt;br /&gt;
a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;TODO&amp;gt; Some more patterns&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23209</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 13 ncs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_13_ncs&amp;diff=23209"/>
		<updated>2009-10-08T23:18:43Z</updated>

		<summary type="html">&lt;p&gt;NCS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Ruby allows much more concise implementations of design patterns for example a single line of code is enough to implement the singleton pattern. We will look at some design patterns and compare the implementation in Ruby vs Java with the goal to determine the following &lt;br /&gt;
&lt;br /&gt;
* can dynamic typed languages realize the design patterns more effectively than statically typed languages &lt;br /&gt;
&lt;br /&gt;
* Are there instances where a design pattern should be used in a dynamic language than a static language &lt;br /&gt;
&lt;br /&gt;
=Design Patterns Analysis=&lt;br /&gt;
&lt;br /&gt;
==Singleton Pattern==&lt;br /&gt;
Resticting the instantiation of the class to a single pattern. &lt;br /&gt;
&lt;br /&gt;
The implementation of the pattern in JAV And Ruby is identical. We need to &lt;br /&gt;
&lt;br /&gt;
* make the constructor private &lt;br /&gt;
&lt;br /&gt;
* declare a instance variable &lt;br /&gt;
&lt;br /&gt;
* implement a getInstance method and make the it thread safe. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;todo&amp;gt; JAVA and ruby singletone examples here. &amp;lt;/todo&amp;gt; &lt;br /&gt;
&lt;br /&gt;
However in JAVA we would need to redo these steps for all classes that we want to be singleton whereas in Ruby we can simply include the singleton module that automatically gets us the functionality listed above. &lt;br /&gt;
&lt;br /&gt;
==Factory Pattern==&lt;br /&gt;
Isolate the code to create an object from the concrete implementation of the class. &lt;br /&gt;
&lt;br /&gt;
In JAVA we typically do something like &lt;br /&gt;
&lt;br /&gt;
interface IObjectFactory {&lt;br /&gt;
&lt;br /&gt;
IGear createObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ConcreteObjectFactory implements IObjectFactory{&lt;br /&gt;
&lt;br /&gt;
IObject createObject() {&lt;br /&gt;
&lt;br /&gt;
if ( ... some condition... )&lt;br /&gt;
&lt;br /&gt;
return new XObject();&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return new YObject();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class ObjectUser {&lt;br /&gt;
&lt;br /&gt;
public void doSomething(IObjectFactory factory ) {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
IObject my_Object = factory.createObject();&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
We can technically do the exact same thing in Ruby however Ruby being a dynamic language there are no special classes or class methods in ruby. Ruby allows us to rename our factory method to be called new&lt;br /&gt;
&lt;br /&gt;
class ObjectFactory&lt;br /&gt;
&lt;br /&gt;
def new() &lt;br /&gt;
&lt;br /&gt;
if ( ... some condition )&lt;br /&gt;
&lt;br /&gt;
return XObject.new()&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
return YObject().new()&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
Our client class now becomes:&lt;br /&gt;
&lt;br /&gt;
class ObjectUser &lt;br /&gt;
&lt;br /&gt;
def doSomething(factory )&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_object = factory.new()&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
=Iterators= Iterators are design patterns used to access the elements of an aggregate object sequentially without exposing its underlying representation. To use iterators we need &lt;br /&gt;
&lt;br /&gt;
* An iterator declared and initialized to point to the collection &lt;br /&gt;
&lt;br /&gt;
* Write a loop and use the iterator to get the value of the next sequential objec tin the collection. &lt;br /&gt;
&lt;br /&gt;
In JAVA we will need to know the type of objects in the collection whereas in ruby iterators are built right in. here are some examples that show the ease with which we can use iterators in Ruby &lt;br /&gt;
&lt;br /&gt;
a = [ 10, 20, 30, 40 ]&lt;br /&gt;
&lt;br /&gt;
a.each { |element| print &amp;quot;The element is #{element}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Thread.list.each { |t| print &amp;quot;Thread: #{t}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
ObjectSpace.each_object { |o| print &amp;quot;Object: #{o}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
open(&amp;quot;data.txt&amp;quot;).each_line { |line| print &amp;quot;The line is #{line}\n&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;TODO&amp;gt; Some more patterns&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
Design patterns are concepts that are equally applicable to solve problems regardless of the language we use to implement the solution. So I cannot think of a case where a specific apttern will be more useful or pertinent to be used in a dynamic language than a static language. However given the features of dynamic languages like Ruby that support metaprogramming and reflection via Modules and Mixins and support extending/reopening classes and redfining methods at run time definitely make it easier to implement patterns with less lines of code. Ruby lets us hide the details of implementations of design patterns much more effectively. You can make a class a singleton with a simple &amp;quot;include Singleton&amp;quot;. You can make factories that look exactly like ordinary classes. You can define visitors with a couple of curly braces. All of this allows you to compress out the details and simply say more interesting things in each line of code.&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20371</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20371"/>
		<updated>2009-09-20T15:30:55Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked vs Unchecked Exceptions &lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. Unchecked exceptions extend the java.lang.RuntimeException. [http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html Checked vs Unchecked] the Controversy.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://portal.acm.org/citation.cfm?id=130948] Exception handling in Object Oriented Systems&lt;br /&gt;
&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html ]Sun Java Tutorial&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20369</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20369"/>
		<updated>2009-09-20T15:26:23Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://portal.acm.org/citation.cfm?id=130948] Exception handling in Object Oriented Systems&lt;br /&gt;
&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html ]Sun Java Tutorial&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20368</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20368"/>
		<updated>2009-09-20T15:26:12Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://portal.acm.org/citation.cfm?id=130948] Exception handling in Object Oriented Systems&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html ]Sun Java Tutorial&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20367</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20367"/>
		<updated>2009-09-20T15:21:47Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html ]Sun Java Tutorial&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20366</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20366"/>
		<updated>2009-09-20T15:21:18Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html Sun Java Tutorial]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20365</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20365"/>
		<updated>2009-09-20T15:20:47Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Try catch and finally blocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html]&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20363</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20363"/>
		<updated>2009-09-20T15:20:01Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Propagating an exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
     % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  try {&lt;br /&gt;
     % code calling updateNameInDBFile&lt;br /&gt;
  } catch (IOException e) {&lt;br /&gt;
    throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20362</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20362"/>
		<updated>2009-09-20T15:19:34Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Propagating an exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
   % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
try {&lt;br /&gt;
   % code calling updateNameInDBFile&lt;br /&gt;
} catch (IOException e) {&lt;br /&gt;
  throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20361</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20361"/>
		<updated>2009-09-20T15:17:51Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Propagating an exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
You can also catch the exception and throw a new exception that the calling layer can understand and recover from.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void updateNameInDBFile(String Name) throws IOException {&lt;br /&gt;
   % Performs some file IO operation and propagates the IOException to calling function&lt;br /&gt;
}&lt;br /&gt;
try {&lt;br /&gt;
&lt;br /&gt;
} catch (IOException e) {&lt;br /&gt;
  throw new NameNotUpdatedException(e); // maps IOException to NameNotUpdatedException&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20356</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20356"/>
		<updated>2009-09-20T15:04:57Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Example: Exception handling in JAVA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Propagating an exception ===&lt;br /&gt;
You don't have to catch exceptions thrown from other methods. If you cannot do anything about the exception where the method throwing it is called, you can just let the method propagate the exception up the call stack to the method that called this method. If you do so the method calling the method that throws the exception must also declare to throw the exception.&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20354</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20354"/>
		<updated>2009-09-20T14:59:13Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Throwing an Exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    public void foo() throws IOException, &lt;br /&gt;
          ArrayIndexOutOfBoundsException {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20353</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20353"/>
		<updated>2009-09-20T14:58:43Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Throwing an Exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
public void foo() throws IOException, ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20352</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20352"/>
		<updated>2009-09-20T14:58:14Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Throwing an Exception */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20351</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20351"/>
		<updated>2009-09-20T14:57:50Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Example: Exception handling in JAVA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;	&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20349</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20349"/>
		<updated>2009-09-20T14:53:12Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions. &lt;br /&gt;
Example NullPointerException.&lt;br /&gt;
&lt;br /&gt;
=== Try catch and finally blocks ===&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
=== Throwing an Exception ===&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20346</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20346"/>
		<updated>2009-09-20T14:49:22Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &amp;lt;br&amp;gt;&lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20345</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20345"/>
		<updated>2009-09-20T14:48:59Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &lt;br /&gt;
http://www.artima.com/designtechniques/images/exceptFig1.gif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20342</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20342"/>
		<updated>2009-09-20T14:46:19Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &lt;br /&gt;
&amp;lt;center&amp;gt;	Object&amp;lt;br&amp;gt; &lt;br /&gt;
 |&amp;lt;br&amp;gt;&lt;br /&gt;
Throwable&amp;lt;br&amp;gt;&lt;br /&gt;
|&amp;lt;br&amp;gt;&lt;br /&gt;
__________________________________&amp;lt;br&amp;gt;&lt;br /&gt;
|					|&amp;lt;br&amp;gt;&lt;br /&gt;
Error					Exception&amp;lt;br&amp;gt;&lt;br /&gt;
...					|&amp;lt;br&amp;gt;&lt;br /&gt;
___________________&amp;lt;br&amp;gt;&lt;br /&gt;
|			|&amp;lt;br&amp;gt;&lt;br /&gt;
......		RunTimeException&amp;lt;br&amp;gt;&lt;br /&gt;
.....&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20341</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20341"/>
		<updated>2009-09-20T14:43:02Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &lt;br /&gt;
&lt;br /&gt;
				&amp;lt;center&amp;gt;	Object&amp;lt;br&amp;gt; &lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
					Throwable&amp;lt;br&amp;gt;&lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
			__________________________________&amp;lt;br&amp;gt;&lt;br /&gt;
			|					|&amp;lt;br&amp;gt;&lt;br /&gt;
			Error					Exception&amp;lt;br&amp;gt;&lt;br /&gt;
			...					|&amp;lt;br&amp;gt;&lt;br /&gt;
							___________________&amp;lt;br&amp;gt;&lt;br /&gt;
							|			|&amp;lt;br&amp;gt;&lt;br /&gt;
							......		RunTimeException&amp;lt;br&amp;gt;&lt;br /&gt;
										.....&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeException se) &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch (SomeOtherException soe)&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20340</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20340"/>
		<updated>2009-09-20T14:41:53Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &lt;br /&gt;
&lt;br /&gt;
				&amp;lt;center&amp;gt;	Object&amp;lt;br&amp;gt; &lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
					Throwable&amp;lt;br&amp;gt;&lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
			__________________________________&amp;lt;br&amp;gt;&lt;br /&gt;
			|					|&amp;lt;br&amp;gt;&lt;br /&gt;
			Error					Exception&amp;lt;br&amp;gt;&lt;br /&gt;
			...					|&amp;lt;br&amp;gt;&lt;br /&gt;
							___________________&amp;lt;br&amp;gt;&lt;br /&gt;
							|			|&amp;lt;br&amp;gt;&lt;br /&gt;
							......		RunTimeException&amp;lt;br&amp;gt;&lt;br /&gt;
										.....&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
     % code that might throw an exception&lt;br /&gt;
  }&lt;br /&gt;
  catch SomeError: &lt;br /&gt;
  { &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  catch SomeOtherError:&lt;br /&gt;
  {  &lt;br /&gt;
     % code that handles this exception&lt;br /&gt;
  }&lt;br /&gt;
  finally   % optional block&lt;br /&gt;
  {&lt;br /&gt;
     % This code will always get executed&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20338</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 3 NCS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_3_NCS&amp;diff=20338"/>
		<updated>2009-09-20T14:40:31Z</updated>

		<summary type="html">&lt;p&gt;NCS: /* Exception hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Exception handling in Object Oriented Languages=&lt;br /&gt;
&lt;br /&gt;
An exception is an abnormal event, which occurs during the execution of a program that interrupts the normal flow of the program. [http://en.wikipedia.org/wiki/Exception_handling Exception handling] is the programming constructs a language provides to handle exceptions. &lt;br /&gt;
&lt;br /&gt;
== Programming Constructs for exception handling ==&lt;br /&gt;
&lt;br /&gt;
Exception handling systems in general strive to improve software reliability, readability, usability, maintainability and easier debugging. &lt;br /&gt;
&lt;br /&gt;
Most modern Object Oriented Language exception handling systems provide the programmers a means to&lt;br /&gt;
=== Raising an exception ===&lt;br /&gt;
When an error occurs within a method, the method creates an object and hands it off to the runtime system. Creating an exception object and handing it to the run time system is called throwing an exception. This done typically using either a throw or raise statement. This statement takes the exception object as an argument.&lt;br /&gt;
&lt;br /&gt;
=== Create Exception Objects ===&lt;br /&gt;
The Exception Object typically contains the following information about the error&lt;br /&gt;
* Type of error&lt;br /&gt;
* State of the program&lt;br /&gt;
* Where the error occurred&lt;br /&gt;
&lt;br /&gt;
Object Oriented languages also allow the programmer to organize the exceptions objects in an inheritance hierarchy allowing the sharing of common behaviors and actions for a set of exceptions. &lt;br /&gt;
&lt;br /&gt;
=== Write Exception handlers ===&lt;br /&gt;
Exception handlers are generally written as blocks of code ( catch/rescue/except blocks ) that can specify the types of exceptions they can handle along with a means to specify the scope of the handler ( try block ). Multiple exceptions can be caught with a single handler.&lt;br /&gt;
&lt;br /&gt;
Using the above statements a programmer can specify a stack of handlers that can be traversed to match an exception with an appropriate handler&lt;br /&gt;
&lt;br /&gt;
=== Match Exceptions with exceptions handlers ===&lt;br /&gt;
Once an exception is raised the run time system will traverse the stack backwards to find an exception handler that can handle the raised exception. Once a handler is found that can handle the raised exception the run time system passes control to the handler along with the exception object.&lt;br /&gt;
&lt;br /&gt;
=== Handling Exceptions ===&lt;br /&gt;
The exception handler routine can look at the exception caught and may decide to perform one of the following actions&lt;br /&gt;
* Resume the program or retry the failed operation&lt;br /&gt;
* Propagate the exception&lt;br /&gt;
* Terminate the program&lt;br /&gt;
* Spawn a debug process &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example: Exception handling in JAVA ==&lt;br /&gt;
=== Exception hierarchy ===&lt;br /&gt;
All Exception objects in JAVA are sub classed from the Exception Object. &lt;br /&gt;
&lt;br /&gt;
				&amp;lt;center&amp;gt;	Object&amp;lt;br&amp;gt; &lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
					Throwable&amp;lt;br&amp;gt;&lt;br /&gt;
					    |&amp;lt;br&amp;gt;&lt;br /&gt;
			__________________________________&amp;lt;br&amp;gt;&lt;br /&gt;
			|					|&amp;lt;br&amp;gt;&lt;br /&gt;
			Error					Exception&amp;lt;br&amp;gt;&lt;br /&gt;
			...					|&amp;lt;br&amp;gt;&lt;br /&gt;
							___________________&amp;lt;br&amp;gt;&lt;br /&gt;
							|			|&amp;lt;br&amp;gt;&lt;br /&gt;
							......		RunTimeException&amp;lt;br&amp;gt;&lt;br /&gt;
										.....&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Checked Exceptions&lt;br /&gt;
Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling. Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown. &lt;br /&gt;
&lt;br /&gt;
* Unchecked Exceptions&lt;br /&gt;
Unchecked exceptions extend the java.lang.RuntimeException.&lt;br /&gt;
&lt;br /&gt;
* Errors &lt;br /&gt;
Errors are hard errors within the JVM. Applications typically do not handle or throw Errors. Errors are unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;
Try catch and finally blocks&lt;br /&gt;
&lt;br /&gt;
The first step for writing exception handlers is to specify the scope of the handler using a try block. the try block encloses the code that can throw exceptions that the exception handler plans on handling. The exception handler itself is specified within the catch block. Each catch block handles the type of exception as specified by the argument of the catch block.  Finally the finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs. The finally block also serves the purpose of avoiding bypassing the clean up code accidentally in the case of an exception or accidentally by a return or a break statement.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  try {&lt;br /&gt;
	% code		  &lt;br /&gt;
    } catch (ArrayIndexOutOfBoundsException e) {&lt;br /&gt;
	% handler for ArrayIndexOutOfBoundsException 			 &lt;br /&gt;
    } catch (IOException e) {&lt;br /&gt;
	% handler for IO exception			 &lt;br /&gt;
    } finally {&lt;br /&gt;
	% clean up &lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
Throwing an Exception&lt;br /&gt;
The throw statement is used to throw an exception. The throw statement requires a single argument: a throwable object. (subclass of the Throwable class). Here's an example of a throw statement.&lt;br /&gt;
&lt;br /&gt;
    throw someThrowableObject;&lt;br /&gt;
&lt;br /&gt;
Specifying exceptions thrown by an Method&lt;br /&gt;
&lt;br /&gt;
public void foo() throws IOException,&lt;br /&gt;
                               ArrayIndexOutOfBoundsException {&lt;br /&gt;
}&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
* Small talk allows exception handlers to be only associated with classes and when an exception is raised it searches for the handler in the class where the exception was raised.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html&lt;/div&gt;</summary>
		<author><name>NCS</name></author>
	</entry>
</feed>