GRASP (object-oriented design): Difference between revisions

Content deleted Content added
changing heading levels
adding the creator pattern
Line 10:
The '''Information Expert''' pattern provides the general principles associated with the assignment of responsibilities to objects. The information expert pattern states that responsibility should be assigned to the '''information expert'''—the class that has all the necessary information. Systems which appropriatley utilize the information expert pattern are easier to under, maintain and expand as well as increase the possibilitiy the an element can be reused in future development.<ref name="larman294">(Larman 294)</ref>
 
<div id="creator"/>
===Creator===
The '''Creator''' pattern solves the problem of who should be responsbile for the creation of a new instance of a class. The creator pattern is important because creation of objects is one of the most ubiquitous activites in an object-oriented system. A system that effectivly utilizes the creator pattern can also support low coupling, increased understandability, encapsulation and the liklihood that the object in question will be capable of sustaining reuse. Given two classes, class B and Class A, class B should be responsibile for the creation of A if class B contains or compositely aggregates, records, closley uses or contains the initlaizing information for class A. It could then be stated that B is a creator of A objects.<ref>(Larman 292)</ref>
 
 
The '''Creator''' pattern deals with assigning the responsibility of creating new objects (instances of classes). New instances of class ''Class'' should be created by a class such that:
* it aggregates instances of ''Class'', or;