<?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=Ppadman</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=Ppadman"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ppadman"/>
	<updated>2026-05-11T01:50:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9622</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9622"/>
		<updated>2007-11-20T01:08:36Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design. &lt;br /&gt;
&lt;br /&gt;
Responsibilities of an Object include two types : ''Knowing'' and ''Doing''&lt;br /&gt;
&lt;br /&gt;
''Doing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
*Initiating action in other objects&lt;br /&gt;
*Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
''Knowing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Knowing about private encapsulated data &lt;br /&gt;
*Knowing about related objects&lt;br /&gt;
*Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9619</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9619"/>
		<updated>2007-11-20T01:08:15Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : ''Knowing'' and ''Doing''&lt;br /&gt;
&lt;br /&gt;
''Doing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
*Initiating action in other objects&lt;br /&gt;
*Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
''Knowing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Knowing about private encapsulated data &lt;br /&gt;
*Knowing about related objects&lt;br /&gt;
*Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9617</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9617"/>
		<updated>2007-11-20T01:07:59Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : ''Knowing'' and ''Doing''&lt;br /&gt;
&lt;br /&gt;
''Doing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
*Initiating action in other objects&lt;br /&gt;
*Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
''Knowing'' responsibilities of an object include:&lt;br /&gt;
&lt;br /&gt;
*Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
*Knowing about related objects&lt;br /&gt;
*Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9615</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9615"/>
		<updated>2007-11-20T01:07:24Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : ''Knowing'' and ''Doing''&lt;br /&gt;
&lt;br /&gt;
''Doing'' responsibilities of an object include:&lt;br /&gt;
1.Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
2.Initiating action in other objects&lt;br /&gt;
3.Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
''Knowing'' responsibilities of an object include:&lt;br /&gt;
1.Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
2.Knowing about related objects&lt;br /&gt;
3.Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9610</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9610"/>
		<updated>2007-11-20T01:05:38Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : ''Knowing'' and ''Doing''&lt;br /&gt;
&lt;br /&gt;
Doing responsibilities of an object include:&lt;br /&gt;
1.Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
2.Initiating action in other objects&lt;br /&gt;
3.Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
Knowing responsibilities of an object include:&lt;br /&gt;
1.Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
2.Knowing about related objects&lt;br /&gt;
3.Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9609</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9609"/>
		<updated>2007-11-20T01:05:18Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* GRASP Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : Knowing and Doing&lt;br /&gt;
&lt;br /&gt;
Doing responsibilities of an object include:&lt;br /&gt;
1.Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
2.Initiating action in other objects&lt;br /&gt;
3.Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
Knowing responsibilities of an object include:&lt;br /&gt;
1.Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
2.Knowing about related objects&lt;br /&gt;
3.Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
1.     [http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0130925691 Applying UML and Patterns: Craig Larman]&lt;br /&gt;
&lt;br /&gt;
2.     [http://people.msoe.edu/~blessing/cs489/cs489-13ch18.pdf Grasp Design Patterns]&lt;br /&gt;
&lt;br /&gt;
3.     [http://www.galileo.cs.uwindsor.ca:8000/60-322/LectureSlides/GRASPPatterns.ppt GRASP Patterns]&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9579</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9579"/>
		<updated>2007-11-20T00:02:59Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : Knowing and Doing&lt;br /&gt;
Doing responsibilities of an object include:&lt;br /&gt;
1.Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
2.Initiating action in other objects&lt;br /&gt;
3.Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
Knowing responsibilities of an object include:&lt;br /&gt;
1.Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
2.Knowing about related objects&lt;br /&gt;
3.Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;br /&gt;
&lt;br /&gt;
9. [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly Example]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9576</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=9576"/>
		<updated>2007-11-20T00:00:55Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it. This is done by defining a set of rules which describes how to solve the problem at hand.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
GRASP Patterns are more of responsibility driven design&lt;br /&gt;
Responsibilities of an Object include two types : Knowing and Doing&lt;br /&gt;
Doing responsibilities of an object include:&lt;br /&gt;
1.Doing something itself, such as creating an object or doing a calculation&lt;br /&gt;
2.Initiating action in other objects&lt;br /&gt;
3.Controlling and coordinating activities in other objects&lt;br /&gt;
&lt;br /&gt;
Knowing responsibilities of an object include:&lt;br /&gt;
1.Knowing about private encapsulated data (know thyself, presume not God to scan)&lt;br /&gt;
2.Knowing about related objects&lt;br /&gt;
3.Knowing about things it can derive or calculate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
To choose between facade and use-case controllers:&lt;br /&gt;
&lt;br /&gt;
1. The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
&lt;br /&gt;
2. The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large  &lt;br /&gt;
and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
[[Image:controller6.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The figure below shows allocation of different operations&lt;br /&gt;
[[Image:controller4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:controller5.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
The game of [http://www.academic.marist.edu/~jzbv/SoftwareDevelopment/GRASP.ppt Monopoly] is an excellent example of a controller pattern. Actors, such as the human player in Monopoly, generate UI events (such as clicking a button with a mouse to play a game or make a move).  The UI software objects (such as a JFrame window and a JButton) must process the event and cause the game to play.   When objects in the UI layer pick up an event, they must delegate the request to an object in the domain layer.&lt;br /&gt;
&lt;br /&gt;
The problem in this case can be formulated as follows:&lt;br /&gt;
What first object beyond the UI layer should receive the message from the UI layer?&lt;br /&gt;
&lt;br /&gt;
As per the controller pattern the solution is as follows:&lt;br /&gt;
Assign the responsibility to an object representing either of following:&lt;br /&gt;
- Represents the overall “system” – a root object&lt;br /&gt;
- Represents a use case scenario within which the system operation occurs.&lt;br /&gt;
&lt;br /&gt;
[[Image:monopoly.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 3==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example 4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:controller2.jpg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:controller.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Example 5==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Image-Controller_example.jpeg&amp;diff=8668</id>
		<title>File:Image-Controller example.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Image-Controller_example.jpeg&amp;diff=8668"/>
		<updated>2007-11-17T14:08:11Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8486</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8486"/>
		<updated>2007-11-15T17:10:49Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=Issues that are important in learning about this topic=&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8477</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8477"/>
		<updated>2007-11-14T19:17:11Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8476</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8476"/>
		<updated>2007-11-14T19:16:06Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The '''Controller pattern''' addresses the question: ''Who handles a system event?'' It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
&lt;br /&gt;
*''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
*It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8475</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8475"/>
		<updated>2007-11-14T19:08:44Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
          o Benefits:&lt;br /&gt;
                + ''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
                + It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8. [http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8474</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8474"/>
		<updated>2007-11-14T19:08:32Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
          o Benefits:&lt;br /&gt;
                + ''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
                + It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.[http://www.dcs.bbk.ac.uk/~niki/lecture5.ppt Presentation on Design Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8473</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8473"/>
		<updated>2007-11-14T19:07:38Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
          o  To choose between facade and use-case controllers:&lt;br /&gt;
                + The ''Facade controller'' is suitable when there are few system events.&lt;br /&gt;
                + The ''Use-case controller'' is applicable when there are many system events and the facade controller would have become too large and incohesive.&lt;br /&gt;
&lt;br /&gt;
          o Benefits:&lt;br /&gt;
                + ''Reuse'' of domain layer software by plugging in various interfaces&lt;br /&gt;
                + It is possible to ''control'' out-of-sequence system events&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8472</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8472"/>
		<updated>2007-11-14T18:22:46Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Description4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_example.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_example.jpeg&amp;diff=8471</id>
		<title>File:Controller example.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_example.jpeg&amp;diff=8471"/>
		<updated>2007-11-14T18:22:17Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8470</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8470"/>
		<updated>2007-11-14T18:19:22Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:http://pg.ece.ncsu.edu/mediawiki/index.php/Image:Controller_Choice.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:2.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_Choice.jpeg&amp;diff=8469</id>
		<title>File:Controller Choice.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_Choice.jpeg&amp;diff=8469"/>
		<updated>2007-11-14T18:18:04Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8468</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8468"/>
		<updated>2007-11-14T18:17:08Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:1.jpeg]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:2.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8467</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8467"/>
		<updated>2007-11-14T18:16:06Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Description4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decoupled from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:]]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_Example.jpg&amp;diff=8466</id>
		<title>File:Controller Example.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_Example.jpg&amp;diff=8466"/>
		<updated>2007-11-14T18:11:25Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_Bitmap_Image.jpg&amp;diff=8465</id>
		<title>File:New Bitmap Image.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_Bitmap_Image.jpg&amp;diff=8465"/>
		<updated>2007-11-14T18:08:05Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: Choice of Controller&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Choice of Controller&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8464</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8464"/>
		<updated>2007-11-14T18:05:52Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
Consider the example of buying items at a supermarket. The cashier enters the items to be purchased and generates a bill for the customer to make the payment at the end of the sale. The system events include:&lt;br /&gt;
&lt;br /&gt;
  ''enterItem()''&lt;br /&gt;
  ''endSale()''&lt;br /&gt;
  ''makePayment()''&lt;br /&gt;
&lt;br /&gt;
The problem can be phrased as: Who is responsible for ''enterItem()''?&lt;br /&gt;
&lt;br /&gt;
Using the Controller Pattern to solve our problem, we can choose among the following: &lt;br /&gt;
&lt;br /&gt;
*The overall system [POST]&lt;br /&gt;
*The overall business(sub-system) [STORE]&lt;br /&gt;
*Someone in the real world who is active in the task [CASHIER]&lt;br /&gt;
*The artificial handler of all system events in the use case [BuyItemsHandler]&lt;br /&gt;
&lt;br /&gt;
[[Image:New Bitmap Image.bmp]]&lt;br /&gt;
&lt;br /&gt;
The choice made should reflect high cohesion and low coupling, as shown below, in which the UI layer is decouple from the problem domain.&lt;br /&gt;
&lt;br /&gt;
[[Image:Controller Example.wmf]] &lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8463</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8463"/>
		<updated>2007-11-14T17:35:21Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.informit.com/content/images/0130925691/samplechapter/0130925691.pdf DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS]&lt;br /&gt;
&lt;br /&gt;
8.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8459</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8459"/>
		<updated>2007-11-14T17:12:42Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Description4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. []&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8455</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8455"/>
		<updated>2007-11-14T05:26:47Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event? It assigns responsibilities for handling system events to different objects.&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
==Description4==&lt;br /&gt;
&lt;br /&gt;
[[http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us  Reference 6] contains the following solution to the problem of who handles the system event: &amp;quot;If a program receives events from external sources other than its graphical interface, add an event class to decouple the event source(s) from the objects that actually handle the events.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
The author also mentions the benefits of using the Controller Pattern as an increased potential for reuse. It leads to decoupling &lt;br /&gt;
between the external sources of events and the internal event handlers.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5. [http://class.ee.iastate.edu/berleant/home/Courses/SoftwareEngineering/CprE486fall2004/GRASP.pdf Controller responsibility]&lt;br /&gt;
&lt;br /&gt;
6. [http://209.85.165.104/search?q=cache:Mgu-Um9Lx1sJ:www.soc.napier.ac.uk/module.php3%3Fop%3Dgetresource%26cloaking%3Dno%26resourceid%3D5938601+controller+pattern+GRASP&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=15&amp;amp;gl=us Presentation on GRASP]&lt;br /&gt;
&lt;br /&gt;
7. []&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8454</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8454"/>
		<updated>2007-11-14T05:07:55Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Description2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    Get Categories&lt;br /&gt;
    Get Product in Category X&lt;br /&gt;
    Get Items in Shopping Cart&lt;br /&gt;
    Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    ProductCatalogHandler&lt;br /&gt;
          -Get Categories&lt;br /&gt;
          -Get Product in Category X&lt;br /&gt;
    ShoppingCartHandler&lt;br /&gt;
          -Get Items in Shopping Cart&lt;br /&gt;
          -Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8453</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8453"/>
		<updated>2007-11-14T05:06:41Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the ''overall system'', device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a ''use case scenario'' within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: ''&amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    * Get Categories&lt;br /&gt;
    * Get Product in Category X&lt;br /&gt;
    * Get Items in Shopping Cart&lt;br /&gt;
    * Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    * ProductCatalogHandler&lt;br /&gt;
          ** Get Categories&lt;br /&gt;
          ** Get Product in Category X&lt;br /&gt;
    * ShoppingCartHandler&lt;br /&gt;
          ** Get Items in Shopping Cart&lt;br /&gt;
          ** Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8452</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8452"/>
		<updated>2007-11-14T05:05:24Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the overall system, device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a use case scenario within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: &amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
This article contains an [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example] of the Controller Pattern. The author classifies controllers as '''Use case Controllers''' and '''Facade Controllers'''. &lt;br /&gt;
&lt;br /&gt;
Use case controllers are useful to handle messages from the User Interface Layer  when there is little coupling between messages. A facade controller to handle all messages will not suffice in this case. &lt;br /&gt;
&lt;br /&gt;
The E-Commerce application in the example considers the following messages:&lt;br /&gt;
&lt;br /&gt;
    * Get Categories&lt;br /&gt;
    * Get Product in Category X&lt;br /&gt;
    * Get Items in Shopping Cart&lt;br /&gt;
    * Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
The first 2 messages are related to a ProductCatalog to ProductCatalogHandler and the last 2 messages are related to the shopper's cart to ShoppingCartHandler:&lt;br /&gt;
&lt;br /&gt;
    * ProductCatalogHandler&lt;br /&gt;
          ** Get Categories&lt;br /&gt;
          ** Get Product in Category X&lt;br /&gt;
    * ShoppingCartHandler&lt;br /&gt;
          ** Get Items in Shopping Cart&lt;br /&gt;
          ** Add Item to Shopping Cart&lt;br /&gt;
&lt;br /&gt;
ProductCatalogHandler and ShoppingCartHandler are highly cohesive, embodied by the Controller Pattern.&lt;br /&gt;
&lt;br /&gt;
==Description3==&lt;br /&gt;
&lt;br /&gt;
This [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog] mentions some examples of the Controller Pattern in the context of blogs. It demonstrates how the controller class beyond the UI layer &amp;quot;hands off&amp;quot; the message to another domain layer object to act upon the message. &lt;br /&gt;
&lt;br /&gt;
Another related [http://davidhayden.com/blog/dave/archive/2004/11/28/648.aspx article] disambiguates between the Controller Pattern and the [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] Architecture. The author defines the controller as &amp;quot;the first object beyond the UI layer that is responsible for receiving or handling a system operation message&amp;quot;. As entailed above, the controller is the coordinator responsible for delegating work to other objects that actually accomplish the task at hand. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3. [http://codebetter.com/blogs/david.hayden/archive/2005/04/08/61648.aspx Blog on GRASP Controller Pattern]&lt;br /&gt;
&lt;br /&gt;
4. [http://www.davidhayden.com/blog/dave/archive/2004/12/10/680.aspx E-Commerce example]&lt;br /&gt;
&lt;br /&gt;
5.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8451</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8451"/>
		<updated>2007-11-14T04:42:19Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the overall system, device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a use case scenario within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: &amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. &lt;br /&gt;
&lt;br /&gt;
  The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method &lt;br /&gt;
  for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8446</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8446"/>
		<updated>2007-11-14T04:03:49Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the overall system, device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a use case scenario within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
Wikipedia succinctly states: &amp;quot;The [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Controller] pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==Description1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. According to the author, one must assign the responsibility for handling a system event to a class that:&lt;br /&gt;
&lt;br /&gt;
  1. Represents the overall system, device, or subsystem.&lt;br /&gt;
  2. Represents a use case scenario in which the system event occurs.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
*The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
******Should we format it as Desc/Example or separate them ?&lt;br /&gt;
&lt;br /&gt;
==Description2==&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. [http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;br /&gt;
&lt;br /&gt;
3.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8445</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8445"/>
		<updated>2007-11-14T03:52:18Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. These events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the overall system, device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a use case scenario within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,and so forth.&lt;br /&gt;
&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represent the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate use case controllers);&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
==1==&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html Reference 1] contains an excellent description of the controller pattern. According to the author, one must assign the responsibility for handling a system event to a class that:&lt;br /&gt;
&lt;br /&gt;
  1. Represents the overall system, device, or subsystem.&lt;br /&gt;
  2. Represents a use case scenario in which the system event occurs.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
*The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) Wikipedia link to GRASP]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8442</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8442"/>
		<updated>2007-11-14T03:46:40Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
The Controller pattern addresses the question: Who handles a system event?&lt;br /&gt;
&lt;br /&gt;
Sometimes, an event is initiated from an external source. A class receives the event, but it may not handle the event. Larman suggests that these events should be handled by classes representing one of the following choices:&lt;br /&gt;
* A class that represents the overall system, device, or subsystem (facade controller).&lt;br /&gt;
* A class that represents a use case scenario within which the system event occurs. These are often named &amp;lt;usecasename&amp;gt;Handler, &amp;lt;usecasename&amp;gt;Controller, &amp;lt;usecasename&amp;gt;Manager,&lt;br /&gt;
and so forth.&lt;br /&gt;
If you choose the second case, you might want to use the came controller class for all system in&lt;br /&gt;
the particular use case scenario. The only reason for not doing so is that the class becomes too&lt;br /&gt;
complex and it becomes better to delegate the work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html contains an excellent description of the controller pattern. According to the author, one must assign the responsibility for handling a system event to a class that:&lt;br /&gt;
&lt;br /&gt;
  1. Represents the overall system, device, or subsystem.&lt;br /&gt;
  2. Represents a use case scenario in which the system event occurs.&lt;br /&gt;
&lt;br /&gt;
*A system event is said to be an event generated by an &amp;quot;external actor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*A system operation refers to the response of the system to a system event. &lt;br /&gt;
&lt;br /&gt;
*The controller is &amp;quot;A non-user interface object responsible for receiving or handling a system event, and that defines the method for the system operation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The website also contains a diagram showing the general context of the Controller, depicted below. (INCLUDE DIAGRAM HERE)&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
[http://www.augustana.ab.ca/~mohrj/courses/2003.fall/csc220/lecture_notes/responsibilities.html GRASP Patterns]&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8435</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8435"/>
		<updated>2007-11-14T03:30:42Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
A [http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Design Pattern] refers to a named description of a problem and a solution that can be applied in different contexts. Patterns are ''proven solutions to common problems''.&lt;br /&gt;
&lt;br /&gt;
==GRASP Patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design) GRASP] refers to '''G'''eneral '''R'''esponsibility '''A'''ssignment '''S'''oftware '''P'''atterns. It includes a systematic approach to [http://en.wikipedia.org/wiki/Object_oriented_design Object Oriented Design], while assigning responsibilities to classes.&lt;br /&gt;
&lt;br /&gt;
The GRASP Patterns include:&lt;br /&gt;
* Information Expert&lt;br /&gt;
* Creator&lt;br /&gt;
* Controller&lt;br /&gt;
* Low Coupling&lt;br /&gt;
* High Cohesion&lt;br /&gt;
* Polymorphism&lt;br /&gt;
* Pure Fabrication&lt;br /&gt;
* Indirection&lt;br /&gt;
* Protected Variations&lt;br /&gt;
&lt;br /&gt;
Some of these, such as &amp;quot;Low Coupling&amp;quot; and &amp;quot;High Cohesion&amp;quot; are merely good design principles, and not design patterns.&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
Applying UML and Patterns: Craig Larman&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8389</id>
		<title>CSC/ECE 517 Fall 2007/wiki3 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki3_6_pm&amp;diff=8389"/>
		<updated>2007-11-13T21:07:30Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
-Brief intro&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8388</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8388"/>
		<updated>2007-11-13T21:07:10Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8364</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8364"/>
		<updated>2007-11-13T16:25:13Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
-Brief intro&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8363</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8363"/>
		<updated>2007-11-13T16:24:20Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
==The Controller Pattern==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
-Brief intro&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8362</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8362"/>
		<updated>2007-11-13T16:23:46Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.''&lt;br /&gt;
&lt;br /&gt;
==The Controller Pattern==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
--------Brief intro&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8361</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8361"/>
		<updated>2007-11-13T16:18:01Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Controller Pattern=&lt;br /&gt;
&lt;br /&gt;
=Problem Description=&lt;br /&gt;
&lt;br /&gt;
Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8360</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 6 pm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_6_pm&amp;diff=8360"/>
		<updated>2007-11-13T16:15:21Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Problem Description=&lt;br /&gt;
&lt;br /&gt;
Take the Controller pattern (which we did not cover in class) and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8199</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8199"/>
		<updated>2007-10-30T03:30:17Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Productivity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
All actions in Struts must be mapped in an XML file. Return values use indirection (Success/Failure) that must be mapped in the XML &lt;br /&gt;
file. In Rails, this is handled by reflection (the framework figures out how the configuration should look).&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
Validation in Struts requires the use of &amp;quot;model mirrors&amp;quot; called ActionForms. These mirrors have a 1-1 mapping to your model files a lot of the time, but result in 'repeating yourself'. In Rails, validation occurs in the model. For example: &lt;br /&gt;
&lt;br /&gt;
  class MusicCd &amp;lt; ActiveRecord::Base&lt;br /&gt;
    validates_presence_of :title, :artist, :genre, :quantity, :price&lt;br /&gt;
    validates_numericality_of :price&lt;br /&gt;
    validates_uniqueness_of :title&lt;br /&gt;
      protected&lt;br /&gt;
        def validate&lt;br /&gt;
        errors.add(:price,&amp;quot;of the CD should be a positive value&amp;quot;)unless price.nil? || price &amp;gt; 0.0&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The presentation of validation errors are kept in the Action Controller.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for bridging components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8198</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8198"/>
		<updated>2007-10-30T03:29:48Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Productivity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
All actions in Struts must be mapped in an XML file. Return values use indirection (Success/Failure) that must be mapped in the XML &lt;br /&gt;
file. In Rails, this is handled by reflection (the framework figures out how the configuration should look).&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
Validation in Struts requires the use of &amp;quot;model mirrors&amp;quot; called ActionForms. These mirrors have a 1-1 mapping to your model files a lot of the time, but result in 'repeating yourself'. In Rails, validation occurs in the model. For example: &lt;br /&gt;
&lt;br /&gt;
  class MusicCd &amp;lt; ActiveRecord::Base&lt;br /&gt;
    validates_presence_of :title, :artist, :genre, :quantity, :price&lt;br /&gt;
    validates_numericality_of :price&lt;br /&gt;
    validates_uniqueness_of :title&lt;br /&gt;
      protected&lt;br /&gt;
        def validate&lt;br /&gt;
         errors.add(:price,&amp;quot;of the CD should be a positive value&amp;quot;)unless price.nil? || price &amp;gt; 0.0&lt;br /&gt;
	  end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The presentation of validation errors are kept in the Action Controller.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for bridging components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8197</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8197"/>
		<updated>2007-10-30T03:28:27Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Architectural Differences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
All actions in Struts must be mapped in an XML file. Return values use indirection (Success/Failure) that must be mapped in the XML &lt;br /&gt;
file. In Rails, this is handled by reflection (the framework figures out how the configuration should look).&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
Validation in Struts requires the use of &amp;quot;model mirrors&amp;quot; called ActionForms. These mirrors have a 1-1 mapping to your model files a lot of the time, but result in 'repeating yourself'. In Rails, validation occurs in the model. For example: &lt;br /&gt;
&lt;br /&gt;
  class MusicCd &amp;lt; ActiveRecord::Base&lt;br /&gt;
	  has_many :sold_music_cd&lt;br /&gt;
	  validates_presence_of :title, :artist, :genre, :quantity, :price&lt;br /&gt;
    	  validates_numericality_of :price&lt;br /&gt;
	  validates_uniqueness_of :title&lt;br /&gt;
	  protected&lt;br /&gt;
	  def validate&lt;br /&gt;
		  errors.add(:price,&amp;quot;of the CD should be a positive value&amp;quot;)unless price.nil? || price &amp;gt; 0.0&lt;br /&gt;
	  end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The presentation of validation errors are kept in the Action Controller.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for bridging components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8196</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8196"/>
		<updated>2007-10-30T03:28:11Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Comparison and Evaluation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
All actions in Struts must be mapped in an XML file. Return values use indirection (SUCCESS/FAILURE) that must be mapped in the XML &lt;br /&gt;
file. In Rails, this is handled by reflection (the framework figures out how the configuration should look).&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
Validation in Struts requires the use of &amp;quot;model mirrors&amp;quot; called ActionForms. These mirrors have a 1-1 mapping to your model files a lot of the time, but result in 'repeating yourself'. In Rails, validation occurs in the model. For example: &lt;br /&gt;
&lt;br /&gt;
  class MusicCd &amp;lt; ActiveRecord::Base&lt;br /&gt;
	  has_many :sold_music_cd&lt;br /&gt;
	  validates_presence_of :title, :artist, :genre, :quantity, :price&lt;br /&gt;
    	  validates_numericality_of :price&lt;br /&gt;
	  validates_uniqueness_of :title&lt;br /&gt;
	  protected&lt;br /&gt;
	  def validate&lt;br /&gt;
		  errors.add(:price,&amp;quot;of the CD should be a positive value&amp;quot;)unless price.nil? || price &amp;gt; 0.0&lt;br /&gt;
	  end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The presentation of validation errors are kept in the Action Controller.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for bridging components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8167</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=8167"/>
		<updated>2007-10-30T02:27:53Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for bridging components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7753</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7753"/>
		<updated>2007-10-25T03:30:42Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for configuration and gluing the components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7752</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7752"/>
		<updated>2007-10-25T03:30:21Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Architectural Differences ==&lt;br /&gt;
&lt;br /&gt;
Both rely on the MVC Architecture. But they differ slightly in the implementation of the front controller.&lt;br /&gt;
With Struts, a developer needs to externalize mappings of requests to Action classes in an XML configuration file. Rails does not require this mapping, but discovers the mapping based on the URL specified. For example, http://localhost/product/delete/4 indicates that the fourth product must be deleted. Rails is smart enough to know that /product maps to a controller class defined in a file named product_controller.rb. If there is a find method defined in the controller, that method can be invoked by simply replacing delete with find in the URL.&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent. Apache Struts facilitates the creation of an extensible development environment for enterprise-grade applications, based on industry standards and established design patterns. A very simple application may be structured without the need for Struts,  but for a complicated application that need to be maintained over time, Struts offers an ideal solution.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a very new and exciting framework that has generated considerable interest in the Web development community, the core architecture follows the basic patterns found in J2EE. The approach to development of Web applications sets the two frameworks apart. &lt;br /&gt;
&lt;br /&gt;
Rails follows DRY and CoC instead of configuration files like Struts, and the dynamic nature of the Ruby language generates much of the code at runtime.  The typical J2EE stack tends to be built from components that are usually developed independently of one another, and XML is often used for configuration and gluing the components together.&lt;br /&gt;
&lt;br /&gt;
Rails is based upon industry accepted enterprise patterns, and Ruby language allows for fast development, due to its dynamic nature and is extremely popular.&lt;br /&gt;
At the same time, Struts, based on J2EE, is more established than the relatively-new Rails. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks Comparison of web application frameworks]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://www.roseindia.net/struts/ Struts Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7741</id>
		<title>CSC/ECE 517 Fall 2007/wiki2 1 p23</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2007/wiki2_1_p23&amp;diff=7741"/>
		<updated>2007-10-25T03:14:17Z</updated>

		<summary type="html">&lt;p&gt;Ppadman: /* Database Migration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Ruby on Rails and Apache Struts: A comparison based study =&lt;br /&gt;
&lt;br /&gt;
There exist several [http://en.wikipedia.org/wiki/Web_Application_Framework web application development frameworks] in the market. A software developer faces a dilemma regarding which of these to employ to implement his application, based on criteria such as enhanced productivity, complexity, scalability, requirement satisfaction, maintenance, etc. This article aims to compare two such frameworks, '''[http://www.rubyonrails.org/ Ruby on Rails]''' and '''[http://struts.apache.org/ Apache Struts]''', from the perspective of the developer and that of the finished application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Web_Application_Framework Web application frameworks] are employed to develop dynamic web pages as well as web applications and services. Generally, web application frameworks comprise libraries compiled into a cohesive software stack. &lt;br /&gt;
Web applications differ from static web pages in that they allow the generation of dynamic responses through database interaction. &lt;br /&gt;
&lt;br /&gt;
Ruby on Rails as well as Apache Struts are based on what is known as the [http://en.wikipedia.org/wiki/Model_View_Controller Model-View-Controller (MVC)] architectural pattern. The concept underlying MVC is to separate the presentation layer (view) from the logic and the data model. This ensures that any changes to the user interface will not affect the business logic, and reorganization of the data model will not affect the user's view. [http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails] and the [http://en.wikipedia.org/wiki/Apache_Struts Apache Struts] framework are both based on the MVC Architecture.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ruby on Rails =&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is a framework that facilitates the development, deployment and maintenance of web applications, written in the '''[http://www.ruby-lang.org/en/ Ruby]''' programming language. &lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
Rails was designed with the underlying concept of [http://en.wikipedia.org/wiki/DRY Don't Repeat Yourself (DRY)], which emphasizes that every piece of information in the system should be expressed only once. As a result, changes to applications designed with Rails will impact a lot less code than they would in other frameworks.&lt;br /&gt;
&lt;br /&gt;
Another paradigm that Rails is based on is [http://en.wikipedia.org/wiki/Convention_over_Configuration Convention over Configuration (CoC)], which means that Rails has defaults for every aspect of the application being developed. Hence, following conventions can lead to application deployment with much less code than would have been written in another programming language. Rails is the first framework to have adopted this paradigm. Ruby also provides ''[http://en.wikipedia.org/wiki/Scaffold_%28programming%29 scaffolding]'', an &amp;quot;autogenerated  framework for manipulating a model&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Rails is designed based on the MVC Architecture. It enforces a structure for the application where models, views and controllers are developed functionally separately, and then knit together during the execution of the application. Incoming requests are sent to a 'router', which computes where the request must be directed to, and how it must be interpreted. This directs the request to a method in the ''controller'' (an action), which performs some data manipulation or computation. The data is then rendered as a ''view'' to the user.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
Rails' framework consists of the following packages: Active Record, Action Pack, Active Support, Action Mailer and Action Web Service.&lt;br /&gt;
&lt;br /&gt;
=== Active Record ===&lt;br /&gt;
&lt;br /&gt;
Rails maps relational database tuples to objects using [http://en.wikipedia.org/wiki/Active_record Active Record]: tables map to classes, rows to objects, and columns to object attributes. Active Record facilitates the implementation of the primitive database operations: Create, Read, Update and Delete. It is also the model part that allows the user to define relationships such as ''belongs_to'' and ''has_many''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Apache Struts =&lt;br /&gt;
&lt;br /&gt;
Apache Struts is a web application framework for developing web applications in [http://java.sun.com/javaee/ Java].&lt;br /&gt;
&lt;br /&gt;
== Design Paradigms ==&lt;br /&gt;
&lt;br /&gt;
The key technologies underlying the core control layer of the Struts framework are Java Servlets, JavaBeans and XML.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
Struts achieves separation between data, views and the underlying logic, according to the MVC architecture. It  provides the controller (ActionServlet) and the views, which can be generated for the user interface, usually with JSP. The developer must bridge the view and the controller together the model - with a configuration file struts-config.xml. Messaging between components is achieved through [http://en.wikipedia.org/wiki/JavaBeans JavaBeans].&lt;br /&gt;
 &lt;br /&gt;
Like Ruby on Rails, the 'router' receives requests and actions defined in the configuration file determine the processing of the request. The Action class corresponding to this action is called, and it interacts with the model to receive a string (ActionForward) indicating where the results must be directed.&lt;br /&gt;
&lt;br /&gt;
=== ActionServlet ===&lt;br /&gt;
&lt;br /&gt;
ActionServlet provides the controller for the framework and performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Identifies the action procedure to direct the incoming request to.&lt;br /&gt;
  &lt;br /&gt;
* Uses this to map to the corresponding Java action class name (an implementation of the Action or Command interface).&lt;br /&gt;
  &lt;br /&gt;
* Populate the field properties of the associated ActionForm bean.&lt;br /&gt;
&lt;br /&gt;
* Call the execute method&lt;br /&gt;
&lt;br /&gt;
== Other Features ==&lt;br /&gt;
&lt;br /&gt;
Struts supports [http://en.wikipedia.org/wiki/Internationalization_and_localization internationalization], and also includes a template mechanism (Tiles). This is achieved by including a library of markup tags.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Evaluation =&lt;br /&gt;
&lt;br /&gt;
These web application frameworks can be compared against each other based on several criteria, as given below. &lt;br /&gt;
&lt;br /&gt;
== Comparison criteria ==&lt;br /&gt;
&lt;br /&gt;
== Productivity ==&lt;br /&gt;
&lt;br /&gt;
The Ruby developer is more productive by spending less time writing code. The database migrations enhance productivity by reducing effort spent in switching between schema versions.  In the traditional J2EE environment, version control would be required for the developer to achieve the same. &lt;br /&gt;
&lt;br /&gt;
With Rails, one line of code, namely, ''scaffold :table_name'' can generate all the CRUD methods required for the application. Achieving the same in the traditional J2EE environment translates roughly to a hundred lines of code.&lt;br /&gt;
&lt;br /&gt;
On the other hand, Apache Struts contains a predefined tag library, to process the content of JavaBeans from the views without the need for any embedded Java code.&lt;br /&gt;
&lt;br /&gt;
== Scalability ==&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is often criticized for its poor scalability. Apache Struts is meant for applications that need to be scalable, to a large extent.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
&lt;br /&gt;
Internationalization refers to the adaptation of computer software to different environments. Struts supports this, whereas Rails currently does not have any explicit support for internationalization, but offers Globalization plugins. &lt;br /&gt;
&lt;br /&gt;
== Database Migration ==&lt;br /&gt;
&lt;br /&gt;
Apache does not contain a DB migration framework like Rails does.&lt;br /&gt;
The database migrations enhance productivity by reducing effort spent in switching between schema versions. In the traditional J2EE environment, version control would be required for the developer to achieve the same.&lt;br /&gt;
&lt;br /&gt;
== Platforms ==&lt;br /&gt;
&lt;br /&gt;
Considering the platforms these two applications are built upon, a big difference is that Java on the server is targeted at the enterprise.  Anyone who wants to run a Java EE application will most likely host their own servers.&lt;br /&gt;
&lt;br /&gt;
Ruby on Rails is targeting a different population:  the &amp;quot;Web sites in-between&amp;quot;, that are not massively scalable but a fair amount of usage. PHP is not an option since it's installed virtually on 99% of Internet Providers. Hence, Rails being hosted natively is the perfect solution.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
'''[http://pragprog.com/titles/rails2/index.html Agile Web Development with Rails]''' by Dave Thomas and David Heinemeier Hansson, with Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland, and Andreas Schwarz&lt;br /&gt;
&lt;br /&gt;
'''Model Driven Development with Rails''' by Antonios Protopsaltou&lt;br /&gt;
&lt;br /&gt;
'''[http://opensource.atlassian.com/confluence/oss/display/BOOKS/ISBN-978-1-4303-2033-3 Starting with Struts2]''' by Ian Roughley&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
'''[http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revisited.html Ruby on Rails Tutorial]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://en.wikipedia.org/wiki/Ruby_on_rails Ruby on Rails]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.rubyonrails.org/rails Rails Wiki]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://cwiki.apache.org/WW/nutshell.html Struts MVC in a nutshell]'''&lt;br /&gt;
&lt;br /&gt;
'''[http://wiki.apache.org/struts/StrutsCatalog An overview of the Struts framework and Design Patterns and Practices]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;br /&gt;
&lt;br /&gt;
'''[ ]'''&lt;/div&gt;</summary>
		<author><name>Ppadman</name></author>
	</entry>
</feed>