<?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=Acmoore2</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=Acmoore2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Acmoore2"/>
	<updated>2026-05-26T19:52:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15827</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15827"/>
		<updated>2008-07-26T15:00:37Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly&lt;br /&gt;
occurring problem in software design. A design pattern is not a finished design that can be&lt;br /&gt;
transformed directly into code. It is a description or template for how to solve a problem &lt;br /&gt;
that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_&lt;br /&gt;
computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====State Patterns====&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Basic Relationship Patterns====&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern[http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns]. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Manager Pattern====&lt;br /&gt;
The Manager Design Pattern listed by the Patterns Almanac is the final pattern that I think would be a great addition to the cirriculum. The Manager Designed Pattern was authored by P. Sommerland and the key aspect is that the management of each instance of a class is extracted from the object itself and designated to a Manager object. This allows for a much wider variation in functionality and for the reuse of Manager objects for a wide array of classes.&lt;br /&gt;
&lt;br /&gt;
I have seen recently in a project I have worked on at work the implementation of this design pattern. It has led to a simplification of real-time job management where each job object is assigned to a manager to handle it's management operations. I think this would is an excellent design pattern and could use more exposure.&lt;br /&gt;
&lt;br /&gt;
Just like I have experienced, EventHelix.com has implemented this design pattern in a realtime system.[http://www.eventhelix.com/RealtimeMantra/ManagerDesignPattern.htm] www.cs.wustl.edu has put together a great presentation on the Manager Design Pattern as well. [http://www.cs.wustl.edu/~schmidt/PLoP-96/sommerlad.ps.gz]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
There was an incredible number of design patterns that were included in the Pattern Almanac and many of them are extremely effective, even though they are seldom discussed. I have tried to expose a couple of the design patterns I saw most relevant. The conclusion I have reached from my research is that design patterns are a crutial means of software development and design and can be used more than they currently are.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Design_pattern_(computer_science)&lt;br /&gt;
&lt;br /&gt;
[2]http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
[3]http://en.wikipedia.org/wiki/Adapter_pattern&lt;br /&gt;
&lt;br /&gt;
[4]http://en.wikipedia.org/wiki/Command_pattern&lt;br /&gt;
&lt;br /&gt;
[5]http://en.wikipedia.org/wiki/Strategy_pattern &lt;br /&gt;
&lt;br /&gt;
[6]http://www.smallmemory.com/almanac/&lt;br /&gt;
&lt;br /&gt;
[7] http://www.smallmemory.com/almanac/DysonEtc98.html&lt;br /&gt;
&lt;br /&gt;
[8] http://www.smallmemory.com/almanac/Noble99a.html&lt;br /&gt;
&lt;br /&gt;
[9] http://www.smallmemory.com/almanac/Sommerlad98.html&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Finite_State_Machine&lt;br /&gt;
&lt;br /&gt;
[11] http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns&lt;br /&gt;
&lt;br /&gt;
[12] http://www.cs.wustl.edu/~schmidt/PLoP-96/sommerlad.ps.gz&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15825</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15825"/>
		<updated>2008-07-26T14:52:17Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====State Patterns====&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Basic Relationship Patterns====&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern[http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns]. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Manager Pattern====&lt;br /&gt;
The Manager Design Pattern listed by the Patterns Almanac is the final pattern that I think would be a great addition to the cirriculum. The Manager Designed Pattern was authored by P. Sommerland and the key aspect is that the management of each instance of a class is extracted from the object itself and designated to a Manager object. This allows for a much wider variation in functionality and for the reuse of Manager objects for a wide array of classes.&lt;br /&gt;
&lt;br /&gt;
I have seen recently in a project I have worked on at work the implementation of this design pattern. It has led to a simplification of real-time job management where each job object is assigned to a manager to handle it's management operations. I think this would is an excellent design pattern and could use more exposure.&lt;br /&gt;
&lt;br /&gt;
Just like I have experienced, EventHelix.com has implemented this design pattern in a realtime system.[http://www.eventhelix.com/RealtimeMantra/ManagerDesignPattern.htm] www.cs.wustl.edu has put together a great presentation on the Manager Design Pattern as well. [www.cs.wustl.edu/~schmidt/PLoP-96/]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
There was an incredible number of design patterns that were included in the Pattern Almanac and many of them are extremely effective, even though they are seldom discussed. I have tried to expose a couple of the design patterns I saw most relevant. The conclusion I have reached from my research is that design patterns are a crutial means of software development and design and can be used more than they currently are.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Finite_State_Machine]&lt;br /&gt;
&lt;br /&gt;
[http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns]&lt;br /&gt;
&lt;br /&gt;
[www.cs.wustl.edu/~schmidt/PLoP-96/sommerlad.ps.gz]&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15824</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15824"/>
		<updated>2008-07-26T14:49:20Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====State Patterns====&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====Basic Relationship Patterns====&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern[http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns]. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====Manager Pattern====&lt;br /&gt;
The Manager Design Pattern listed by the Patterns Almanac is the final pattern that I think would be a great addition to the cirriculum. The Manager Designed Pattern was authored by P. Sommerland and the key aspect is that the management of each instance of a class is extracted from the object itself and designated to a Manager object. This allows for a much wider variation in functionality and for the reuse of Manager objects for a wide array of classes.&lt;br /&gt;
&lt;br /&gt;
I have seen recently in a project I have worked on at work the implementation of this design pattern. It has led to a simplification of real-time job management where each job object is assigned to a manager to handle it's management operations. I think this would is an excellent design pattern and could use more exposure.&lt;br /&gt;
&lt;br /&gt;
Just like I have experienced, EventHelix.com has implemented this design pattern in a realtime system.[http://www.eventhelix.com/RealtimeMantra/ManagerDesignPattern.htm] www.cs.wustl.edu has put together a great presentation on the Manager Design Pattern as well. [www.cs.wustl.edu/~schmidt/PLoP-96/sommerlad.ps.gz]&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
There was an incredible number of design patterns that were included in the Pattern Almanac and many of them are extremely effective, even though they are seldom discussed. I have tried to expose a couple of the design patterns I saw most relevant. The conclusion I have reached from my research is that design patterns are a crutial means of software development and design and can be used more than they currently are.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Finite_State_Machine]&lt;br /&gt;
&lt;br /&gt;
[http://synthesis.sbecker.net/articles/2006/01/19/active-record-relationship-design-patterns]&lt;br /&gt;
&lt;br /&gt;
[www.cs.wustl.edu/~schmidt/PLoP-96/sommerlad.ps.gz]&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15819</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15819"/>
		<updated>2008-07-26T14:29:23Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====State Patterns====&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====Basic Relationship Patterns====&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====Manager Pattern====&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15818</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15818"/>
		<updated>2008-07-26T14:28:38Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
====State Patterns====&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==Basic Relationship Patterns==&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==Manager Pattern==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15817</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15817"/>
		<updated>2008-07-26T14:27:28Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Design Patterns====&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==State Patterns==&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==Basic Relationship Patterns==&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==Manager Pattern==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15816</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15816"/>
		<updated>2008-07-26T14:25:28Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Design Patterns====&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
==State Patterns==&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
==Basic Relationship Patterns==&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. This was authored by J. Noble in the Behavioral Category. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object, an Active Value Pattern and a Mutual Friends pattern.&lt;br /&gt;
&lt;br /&gt;
I believe this is a viable design pattern for discussion because of the nature of programming that is continuously using relationships between object. To be able to have a design pattern to maximize understanding between programmers on how these relationships always work would be a vast improvement in the current programming standards.&lt;br /&gt;
&lt;br /&gt;
There are many variations on this design pattern, one of which is the Active Record Relationship Design Pattern. The discussion of this design pattern could be incorporated with our study of Ruby and design patterns.&lt;br /&gt;
&lt;br /&gt;
==Manager Pattern==&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface which are defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following Java example, an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is a basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce between a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[11] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15815</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15815"/>
		<updated>2008-07-26T14:17:01Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
==State Patterns==&lt;br /&gt;
The State Patterns listed in this section of Linda Risings Patterns Almanac where authored by P. Dyson, B. Anderson under the category 'Behavioral, Finite State Machines'. The patterns included in the State Patterns section are the Patterns State Object, State Member, Pure State, Exposed State, State-Driven Transitions, Owner-Driven Transitions and Pattern:Default State.&lt;br /&gt;
&lt;br /&gt;
I thought that this would be an excellent candidate for a potential design pattern addition, especially to a course that discussed processes that could be encapsulated in state objects. The overall pattern tries to define a manner to efficiently handle changes of state, during runtime for example, tracking current state attributes and to try to delegate state-dependant behavior to the state object.&lt;br /&gt;
&lt;br /&gt;
Other variations of the State Pattern are also discussed by Wikipedia[http://en.wikipedia.org/wiki/State_pattern] which also references implementing the design pattern with Finite State Machines[http://en.wikipedia.org/wiki/Finite_State_Machine].&lt;br /&gt;
&lt;br /&gt;
==Basic Relationship Patterns==&lt;br /&gt;
The Basic Relationship Design Pattern narrows in on the design of any relationship between two objects in a program and how these objects can effectively and efficiently communicate and interact. The pattern is made up of a Relationship vs. Attribute Pattern, a Relationship Object&lt;br /&gt;
==Manager Pattern==&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Adapter_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Command_pattern]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/DysonEtc98.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Noble99a.html]&lt;br /&gt;
&lt;br /&gt;
[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface which are defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following Java example, an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is a basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce between a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[11] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15814</id>
		<title>CSC/ECE 517 Summer 2008/wiki3 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki3_2_acmoore2&amp;diff=15814"/>
		<updated>2008-07-26T13:52:09Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course! ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Design Patterns===&lt;br /&gt;
&lt;br /&gt;
Throughout the semester, the coursework has dedicated a lot of time to the discussion of Design Patterns. As stated by Christopher Alexander, in his book ''A Timeles Way of Building'', a design pattern is a &amp;quot;solution to a problem in a context.&amp;quot; Wikipedia defines software design patterns as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the design patterns we have discussed in class were O-O design patterns. For example, during our lectures on Ruby we discussed several design patterns such as the Singleton[http://en.wikipedia.org/wiki/Singleton_pattern], the Adapter Pattern[http://en.wikipedia.org/wiki/Adapter_pattern], the Command Pattern[http://en.wikipedia.org/wiki/Command_pattern], and the Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] to name a few. &lt;br /&gt;
&lt;br /&gt;
The design patterns discussed were by no means a comprehensive list. The Patterns Almanac[http://www.smallmemory.com/almanac/] is a resource for other design patterns that could potentially be included in future CSC 517 course lecture work. I have selected to discuss State Patterns[http://www.smallmemory.com/almanac/DysonEtc98.html], Basic Relationship Patterns[http://www.smallmemory.com/almanac/Noble99a.html] and the Manager Pattern[http://www.smallmemory.com/almanac/Sommerlad98.html]&lt;br /&gt;
&lt;br /&gt;
===State Patterns===&lt;br /&gt;
&lt;br /&gt;
===Basic Relationship Patterns===&lt;br /&gt;
&lt;br /&gt;
===Manager Pattern===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface which are defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following Java example, an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is a basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce between a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[11] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14207</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14207"/>
		<updated>2008-06-30T23:55:50Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only [http://en.wikipedia.org/wiki/Software_engineering software engineering] but [http://en.wikipedia.org/wiki/Systems_engineering system engineering]. [http://www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [http://www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing [http://en.wikipedia.org/wiki/Software_engineering software engineering] topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using [http://en.wikipedia.org/wiki/Use_case#Use_case_templates use case templates] is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this example is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, [http://www.parlezuml.com/tutorials/usecases/usecases_intro.pdf 'Use Cases: An Introduction'] does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled [http://www.parlezuml.com/tutorials/usecases/usecases.pdf 'Driving Development with Use Cases']. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a [http://www.readysetpro.com/whitepapers/usecasetut.html six step approach] on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample examples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14206</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14206"/>
		<updated>2008-06-30T23:53:34Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only [http://en.wikipedia.org/wiki/Software_engineering software engineering] but [http://en.wikipedia.org/wiki/Systems_engineering system engineering]. [http://www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [http://www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing [http://en.wikipedia.org/wiki/Software_engineering software engineering] topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using [http://en.wikipedia.org/wiki/Use_case#Use_case_templates use case templates] is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this example is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, [http://www.parlezuml.com/tutorials/usecases/usecases_intro.pdf 'Use Cases: An Introduction'] does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled [http://www.parlezuml.com/tutorials/usecases/usecases.pdf 'Driving Development with Use Cases']. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14205</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14205"/>
		<updated>2008-06-30T23:47:24Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only [http://en.wikipedia.org/wiki/Software_engineering software engineering] but [http://en.wikipedia.org/wiki/Systems_engineering system engineering]. [http://www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [http://www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing [http://en.wikipedia.org/wiki/Software_engineering software engineering] topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using [http://en.wikipedia.org/wiki/Use_case#Use_case_templates use case templates] is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14204</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14204"/>
		<updated>2008-06-30T23:40:59Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only [http://en.wikipedia.org/wiki/Software_engineering software engineering] but [http://en.wikipedia.org/wiki/Systems_engineering system engineering]. [http://www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [http://www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14203</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14203"/>
		<updated>2008-06-30T23:39:37Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only software engineering but system engineering. [http://www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [http://www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14202</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14202"/>
		<updated>2008-06-30T23:39:07Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only software engineering but system engineering. [www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [www.google.com/ google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14201</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14201"/>
		<updated>2008-06-30T23:38:35Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only software engineering but system engineering. [www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve [http://en.wikipedia.org/wiki/Actor_%28UML%29 actors], starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [www.google.com google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14200</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14200"/>
		<updated>2008-06-30T23:34:44Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Use_case Use cases] have become an integral part in the development of not only software engineering but system engineering. [www.wikipedia.org/ Wikipedia] defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through the [www.google.com google] search engine, for example, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for [http://en.wikipedia.org/wiki/Software_engineering software requirements engineering].&lt;br /&gt;
&lt;br /&gt;
====[http://en.wikipedia.org/wiki/Use_case Wikipedia]====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====[http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html Inside Infogenium]====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====[http://www.parlezuml.com/tutorials/usecases.htm parlez|uml]====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====[http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf SoftLab]====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====[http://www.readysetpro.com/whitepapers/usecasetut.html ReadySetPro]====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14132</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14132"/>
		<updated>2008-06-26T03:30:04Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for software requirements engineering.&lt;br /&gt;
&lt;br /&gt;
====Wikipedia====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====Inside Infogenium====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====parlez|uml====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====SoftLab====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====ReadySetPro====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
I believe that these five sites, while some were harder to find than others, are all great guides and examples on understanding and eventually creating a use case document.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14131</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14131"/>
		<updated>2008-06-26T03:29:07Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
The following are resources that I would recommend to anyone interesting in learning about use cases for software requirements engineering.&lt;br /&gt;
&lt;br /&gt;
====Wikipedia====&lt;br /&gt;
&lt;br /&gt;
Wikipedia always seems to do a good job summarizing software engineering topics and their article on use cases is no different. They do a good job of giving a good description and overview of what the use cases represent while give a detailed description of how to write use cases. &lt;br /&gt;
&lt;br /&gt;
Especially in today's world, using use case templates is an efficient way to write them and Wikipedia dedicates a whole section for this purpose. Finally the nicely outline the benefits and limitations of use cases.&lt;br /&gt;
&lt;br /&gt;
Overall the article is tremendous in scope however it is lacking in explicit examples that would perhaps help a beginner better understand the direct usage of use cases. &lt;br /&gt;
&lt;br /&gt;
====Inside Infogenium====&lt;br /&gt;
&lt;br /&gt;
Inside Infogenium's article on use cases is like a user friendly version of Wikipedia.com's article. The language is easier to understand and the flow of the explanation is also more user oriented as opposed to a straight educational approach.&lt;br /&gt;
&lt;br /&gt;
The article is limited in its explanation, using very little detail explanation. However, there is a well done, simple, straight forward example of what use cases are meant to do. I think this exmple is very intuitive and helpful.&lt;br /&gt;
&lt;br /&gt;
====parlez|uml====&lt;br /&gt;
&lt;br /&gt;
Parlez|Uml has two great slide shows that would be ideal for someone trying to learn more about use cases. This first slide show, 'Use Cases: An Introduction' does a great job of explaining the use case. There are a lot of diagrams and examples that making the learning very intuitive.&lt;br /&gt;
&lt;br /&gt;
The second slide show that really attracted me to this site is entitled 'Driving Development with Use Cases'. It gives a greal scenario how use cases can be incorporated in the development cycle and how critical they can become to driving software development. It was for this reason that I like this site so well.&lt;br /&gt;
&lt;br /&gt;
====SoftLab====&lt;br /&gt;
&lt;br /&gt;
SoftLab has a slide show presented by Igor Ivkovic posted on their website. Althought this document is not as professional as some of the other websites I looked at I felt that the detail of the scenarios that were presented were key. Some of the simple examples presented on the previous reviewed sites might be adequate for some users, while others could benefit from a more detailed and complete scenario for more complex systems.&lt;br /&gt;
&lt;br /&gt;
I thought the the detailed explanation was well done with complete scenarios. However, the document does become a little wordy and not as user friendly as the other sites.&lt;br /&gt;
&lt;br /&gt;
====ReadySetPro====&lt;br /&gt;
&lt;br /&gt;
ReadySetPro has set forward a tutorial on a six step approach on how to write a use case. There is a lot of effort put into the educational side, learning what it envolves and how the use case is used, that very little energy is put into explaining how exactly to write the use case.&lt;br /&gt;
&lt;br /&gt;
The six step approach by ReadySetPro is very intuitive, excellently laid out and provides ample exmples to help a user create their own use case document.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14112</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14112"/>
		<updated>2008-06-26T03:05:50Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Resources===&lt;br /&gt;
&lt;br /&gt;
====Wikipedia====&lt;br /&gt;
&lt;br /&gt;
http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
====Inside Infogenium====&lt;br /&gt;
&lt;br /&gt;
http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
====parlez|uml====&lt;br /&gt;
&lt;br /&gt;
http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
====SoftLab====&lt;br /&gt;
&lt;br /&gt;
http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
====ReadySetPro====&lt;br /&gt;
&lt;br /&gt;
http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14111</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14111"/>
		<updated>2008-06-26T03:04:52Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
====Resources====&lt;br /&gt;
&lt;br /&gt;
===Wikipedia===&lt;br /&gt;
&lt;br /&gt;
http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
===Inside Infogenium===&lt;br /&gt;
&lt;br /&gt;
http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
===parlez|uml===&lt;br /&gt;
&lt;br /&gt;
http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
====SoftLab====&lt;br /&gt;
&lt;br /&gt;
http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
====ReadySetPro====&lt;br /&gt;
&lt;br /&gt;
http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14110</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14110"/>
		<updated>2008-06-26T03:03:27Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Wikipedia====&lt;br /&gt;
&lt;br /&gt;
http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
===Inside Infogenium===&lt;br /&gt;
&lt;br /&gt;
http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
====parlez|uml====&lt;br /&gt;
&lt;br /&gt;
http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
====SoftLab====&lt;br /&gt;
&lt;br /&gt;
http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
====ReadySetPro====&lt;br /&gt;
&lt;br /&gt;
http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Use_case&lt;br /&gt;
&lt;br /&gt;
[2] http://infogenium.typepad.com/inside_infogenium/2007/07/getting-started.html&lt;br /&gt;
&lt;br /&gt;
[3] http://www.parlezuml.com/tutorials/usecases.htm&lt;br /&gt;
&lt;br /&gt;
[4] http://courses.softlab.ntua.gr/softeng/Tutorials/UML-Use-Cases.pdf&lt;br /&gt;
&lt;br /&gt;
[5] http://www.readysetpro.com/whitepapers/usecasetut.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14083</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14083"/>
		<updated>2008-06-26T02:38:09Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds&lt;br /&gt;
to a request that originates from outside of that system.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Wikipedia.com====&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14081</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14081"/>
		<updated>2008-06-26T02:36:41Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Use cases have become an integral part in the development of not only software engineering but system engineering. Wikipedia defines use cases in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A use case is a description of a system's behaviour as it responds to a request that originates from outside of that system.&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use cases involve actors, starting with a primary actor which initiates an interaction with the system which leads to interacting with all other actors. &lt;br /&gt;
&lt;br /&gt;
This is a pretty straight forward explanation of what a use case is but there is so much more information available on the world wide web regarding this subject. However, with the cluttered nature of the web, acturate, reliable and informative information is hard to come by. &lt;br /&gt;
&lt;br /&gt;
Through this article I will discuss and review the best websites for use case education on the web. While some were easy to find, through www.google.com, for examples, others with perhaps even more thorough information were harder to find.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Wikipedia.com====&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14033</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14033"/>
		<updated>2008-06-26T01:58:36Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14029</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14029"/>
		<updated>2008-06-26T01:56:29Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14023</id>
		<title>CSC/ECE 517 Summer 2008/wiki2 4 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki2_4_acmoore2&amp;diff=14023"/>
		<updated>2008-06-26T01:53:24Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Use cases. There are even more pages on the Web on use cases than on MVC. If someone wants to learn about them, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the use-case sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which teach advanced concepts that are not apparent in perusing most use-case sites? Read at least several dozen pages before deciding how to organize your overview. ''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13136</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13136"/>
		<updated>2008-06-12T03:01:25Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface which are defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following Java example, an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is a basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce between a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[11] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13119</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13119"/>
		<updated>2008-06-12T02:47:56Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[11] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13116</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13116"/>
		<updated>2008-06-12T02:46:12Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10]&lt;br /&gt;
[11]&lt;br /&gt;
[12] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[13] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13115</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13115"/>
		<updated>2008-06-12T02:44:52Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Generator_%28computer_science%29&lt;br /&gt;
&lt;br /&gt;
[8] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[9] http://www.python.org/dev/peps/pep-0289&lt;br /&gt;
&lt;br /&gt;
[10]&lt;br /&gt;
[11]&lt;br /&gt;
[12]&lt;br /&gt;
[13]&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13113</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13113"/>
		<updated>2008-06-12T02:42:26Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
&lt;br /&gt;
[4] http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;br /&gt;
&lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
&lt;br /&gt;
[6]&lt;br /&gt;
[7]&lt;br /&gt;
[8]&lt;br /&gt;
[9]&lt;br /&gt;
[10]&lt;br /&gt;
[11]&lt;br /&gt;
[12]&lt;br /&gt;
[13]&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13111</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13111"/>
		<updated>2008-06-12T02:41:10Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
[1] http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&lt;br /&gt;
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
[3] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Ruby_programming_language&lt;br /&gt;
[5]&lt;br /&gt;
[6]&lt;br /&gt;
[7]&lt;br /&gt;
[8]&lt;br /&gt;
[9]&lt;br /&gt;
[10]&lt;br /&gt;
[11]&lt;br /&gt;
[12]&lt;br /&gt;
[13]&lt;br /&gt;
[14] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13107</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13107"/>
		<updated>2008-06-12T02:38:04Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
===External References===&lt;br /&gt;
&lt;br /&gt;
[1] http://www.ibm.com/developerworks/library/l-pycon.html&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13102</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=13102"/>
		<updated>2008-06-12T02:34:55Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iteration by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator is compared to a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11618</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11618"/>
		<updated>2008-05-31T03:22:26Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11617</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11617"/>
		<updated>2008-05-31T03:21:54Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11616</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11616"/>
		<updated>2008-05-31T03:21:24Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11615</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11615"/>
		<updated>2008-05-31T03:19:03Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
:A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11614</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11614"/>
		<updated>2008-05-31T03:17:21Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)&amp;lt;/pre&amp;gt;[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;/pre&amp;gt;[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7&amp;lt;/pre&amp;gt;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;/pre&amp;gt;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11613</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11613"/>
		<updated>2008-05-31T03:14:03Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation)[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14[http://en.wikipedia.org/wiki/Ruby_programming_language]&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element[http://www.ibm.com/developerworks/library/l-pycon.html]&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11612</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11612"/>
		<updated>2008-05-31T03:13:14Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14[http://en.wikipedia.org/wiki/Ruby_programming_language]&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element[http://www.ibm.com/developerworks/library/l-pycon.html]&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11611</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11611"/>
		<updated>2008-05-31T03:11:56Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14[http://en.wikipedia.org/wiki/Ruby_programming_language]&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element[http://www.ibm.com/developerworks/library/l-pycon.html]&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11610</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11610"/>
		<updated>2008-05-31T03:10:34Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html] There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation[http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());[http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example]&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14[http://en.wikipedia.org/wiki/Ruby_programming_language]&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.[http://en.wikipedia.org/wiki/Generator_%28computer_science%29] The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.[http://www.python.org/dev/peps/pep-0289]     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.[http://www.python.org/dev/peps/pep-0289]&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7[http://en.wikipedia.org/wiki/Generator_%28computer_science%29]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element[http://www.ibm.com/developerworks/library/l-pycon.html]&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass[http://www.ibm.com/developerworks/library/l-pycon.html]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11609</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11609"/>
		<updated>2008-05-31T03:05:38Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;[http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages] &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11608</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11608"/>
		<updated>2008-05-31T03:02:14Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11607</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11607"/>
		<updated>2008-05-31T02:59:56Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11606</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11606"/>
		<updated>2008-05-31T02:58:55Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11605</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11605"/>
		<updated>2008-05-31T02:57:33Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11604</id>
		<title>CSC/ECE 517 Summer 2008/wiki1 2 acmoore2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Summer_2008/wiki1_2_acmoore2&amp;diff=11604"/>
		<updated>2008-05-31T02:56:00Z</updated>

		<summary type="html">&lt;p&gt;Acmoore2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators.''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Iterators Defined===&lt;br /&gt;
&lt;br /&gt;
Any computer programmer with experience has realized the power of an iterator. As defined by Wikipedia.com an iterator is &amp;quot;an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
For example, the programming language Java, has defined an iterator interface in their Java Collections Framework in java.util.&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt; There are three methods included in the interface as defined below:&lt;br /&gt;
&lt;br /&gt;
boolean hasNext() :  Returns true if the iteration has more elements. &lt;br /&gt;
 &lt;br /&gt;
Object next() : Returns the next element in the iteration. &lt;br /&gt;
 &lt;br /&gt;
void remove() : Removes from the underlying collection the last element returned by the iterator (optional operation&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
We can further explore the operations of these methods in iterator functions in the following section.&lt;br /&gt;
&lt;br /&gt;
====Iterator Examples====&lt;br /&gt;
&lt;br /&gt;
In the following example in Java an array arrayList has been defined and populated. The iterator is defined, itr, for arrayList and then the contents can easily be printed out by using an iterator.  &lt;br /&gt;
&lt;br /&gt;
//get an Iterator object for ArrayList using iterator() method.&lt;br /&gt;
Iterator itr = arrayList.iterator();&lt;br /&gt;
&lt;br /&gt;
//use hasNext() and next() methods of Iterator to iterate through the elements&lt;br /&gt;
    System.out.println(&amp;quot;Iterating through ArrayList elements...&amp;quot;);&lt;br /&gt;
    while(itr.hasNext())&lt;br /&gt;
      System.out.println(itr.next());&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
Ruby, like Java allows for iterators and provides a mechinism for iteration. It allows for iteration over enumerations and arrays using blocks. Here is an example of a mixed bag array and then iterating over the array to print out the contents&lt;br /&gt;
&lt;br /&gt;
array = [1, 'hi', 3.14]&lt;br /&gt;
array.each { |item| puts item }&lt;br /&gt;
# =&amp;gt; 1&lt;br /&gt;
# =&amp;gt; 'hi'&lt;br /&gt;
# =&amp;gt; 3.14&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators Defined===&lt;br /&gt;
&lt;br /&gt;
As we have seen with iterators, the ability to traverse through a set or collection is basic need of any programming language. Just as in Java, Ruby has a means of iterator by using a generator. As described in the wiki question,  Python uses a variation on the iterator and uses generators. Wikipedia.com defines generators as &amp;quot;a special routine that can be used to control the iteration behaviour of a loop.&amp;quot;&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; &lt;br /&gt;
     &lt;br /&gt;
A generator has many characteristics of that of a function that returns an array. A generator can have parameters, it can be called, and in return it returns a sequence of values.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt; The differnce from a generator and any other function that returns an array is that the generator is used to return the results one at a time, allowing it to act as an iterator.&lt;br /&gt;
     &lt;br /&gt;
Python.com cites several benefits behind a generator. One improved area is the efficiency of memory use. The generator requires less memory by not having to store and send an entire collection or array rather passing one value at a time.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;     &lt;br /&gt;
Another benefit cited by Python.com is high performance. Like an iterator, a generator returns one value at a time allowing for a process to start accessing the data earlier and faster than it would if it had to wait for the entire array to return.&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Generator Examples====&lt;br /&gt;
&lt;br /&gt;
Our first example can be drawn from Python. This generator will produce prime number indefinitely as seen in the code below.&lt;br /&gt;
&lt;br /&gt;
# Another generator, which produces prime numbers indefinitely as needed.&lt;br /&gt;
 &lt;br /&gt;
def primes():&lt;br /&gt;
    n = 2&lt;br /&gt;
    p = []&lt;br /&gt;
    while True:&lt;br /&gt;
        if not any( n % f == 0 for f in p ):&lt;br /&gt;
            yield n&lt;br /&gt;
            p.append( n )&lt;br /&gt;
        n += 1&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f = primes()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; f.next()&lt;br /&gt;
7 &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Generators That Would Be Awkward with Iterators===&lt;br /&gt;
&lt;br /&gt;
An article by David Mertz in an ibm.com library discussed the advantage of generators and hence why generators can do some things that iterators can't. &lt;br /&gt;
&lt;br /&gt;
     A generator is a function that remembers the point in the function body where it last returned. Calling a generator function a second (or nth) time jumps into the middle of the function, with all local variables intact from the last invocation.&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
He makes a comparison between generators and closures with a distinct difference. &amp;quot;Like a closure, a generator 'remembers' the state of its data. But a generator goes a bit further than a closure: a generator also 'remembers' its position within flow-control constructs.&amp;quot;&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following example, is an example of how a generator is used manually, allowing it to be passed around a program and then called when and wherever needed. &lt;br /&gt;
&lt;br /&gt;
from __future__ import generators   # only needed for Python 2.2&lt;br /&gt;
import random&lt;br /&gt;
def randomwalk_generator():&lt;br /&gt;
    last, rand = 1, random.random() # initialize candidate elements&lt;br /&gt;
    while rand &amp;gt; 0.1:               # threshhold terminator&lt;br /&gt;
        print '*',                  # display the rejection&lt;br /&gt;
        if abs(last-rand) &amp;gt;= 0.4:   # accept the number&lt;br /&gt;
            last = rand             # update prior value&lt;br /&gt;
            yield rand              # return AT THIS POINT&lt;br /&gt;
        rand = random.random()      # new candidate&lt;br /&gt;
    yield rand                      # return the final small element&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
A more simple approach is as follows:&lt;br /&gt;
&lt;br /&gt;
gen = randomwalk_generator()&lt;br /&gt;
try:&lt;br /&gt;
    while 1: print gen.next(),&lt;br /&gt;
except StopIteration:&lt;br /&gt;
    pass&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
&lt;br /&gt;
As has been shown, iterators and generators can both be powerful programming elements throughout any programming language. We can also see that the new age view of using generators does allow for uses that are similar to closures and difficult with iterators.&lt;br /&gt;
&lt;br /&gt;
References: &amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Iterator#Iterators_in_different_programming_languages&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Generator_%28computer_science%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.python.org/dev/peps/pep-0289&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Ruby_programming_language&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://www.ibm.com/developerworks/library/l-pycon.html&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Acmoore2</name></author>
	</entry>
</feed>