CSC/ECE 517 Fall 2007/wiki3 6 rs: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 27: Line 27:


<p ALIGN="justify">  
<p ALIGN="justify">  
Controller Patterns is one of the interesting patterns which answers the question – “What first object beyond the UI layer receives and coordinates or controls a system operations?”  Or “who handles the system event? “  Controller is the primary objects that are responsible for handling the message that is passed by the user through the UI. A controller is said to be present in a problem domain, but the controller is not part of the domain. It assigns responsibility to the other objects of that system. Also controls and coordinates between activities. In this case the controller satisfies the responsibilities of the GRASP patterns.
Controller Patterns is one of the interesting patterns which answers the question – “What first object beyond the UI layer receives and coordinates or controls a system operations?”  Or “Who handles the system event? “  Controller is the primary objects that are responsible for handling the message that is passed by the user through the UI. A controller is said to be present in a problem domain, but the controller is not part of the domain. It assigns responsibility to the other objects of that system. Also controls and coordinates between activities. In this case the controller satisfies the responsibilities of the GRASP patterns.
</p>
 
 
== How does a controller work? ==
<p ALIGN="justify">
Controllers do not perform any work by themselves. The only task of the controller is to pass the responsibility to the domain object so that the object performs that task. It becomes the object’s responsibility to perform the work.
</p>
</p>

Revision as of 01:25, 19 November 2007

Problem Description

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.

Introduction

There are various kinds of design patterns, to help us structure our code and component in order to solve some specific problem and to have effective code for the problem. Craig Larman has defined a set of design patterns which are called as the General Responsibility Assignment Software Patterns (GRASP). GRASP is a tool for learning object oriented design with principles. Controller pattern is one among the GRASP patterns.

There are several principles available for object oriented programming, but these principles cannot be considered as patterns. When we consider cohesion and coupling they are good design principles but do not belong to the group of design patterns. GRASP patterns defines two major types of responsibilities of the patterns-

  • The object knowing the responsibilities
  • The object doing the responsibilities
  • Controller Patterns

    Controller Patterns is one of the interesting patterns which answers the question – “What first object beyond the UI layer receives and coordinates or controls a system operations?” Or “Who handles the system event? “ Controller is the primary objects that are responsible for handling the message that is passed by the user through the UI. A controller is said to be present in a problem domain, but the controller is not part of the domain. It assigns responsibility to the other objects of that system. Also controls and coordinates between activities. In this case the controller satisfies the responsibilities of the GRASP patterns.


    How does a controller work?

    Controllers do not perform any work by themselves. The only task of the controller is to pass the responsibility to the domain object so that the object performs that task. It becomes the object’s responsibility to perform the work.