Creator GRASP Pattern

Creator is the GRAS Patterns (General Responsibility Assignment Software Pattern) Read about GRASP Patterns: GRASP Patterns Overview Problem Who should be responsible for creating a new instance of some class? The creation of objects is one of the most common activities in an object-oriented system. Consequently, it is useful to have a general principle for the assignment of creation responsibilities. Assigned well, the design can support low coupling, increased clarity, encapsulation, and reusability. Solution Assign class B the responsibility to create an instance of class A if one or more of the following is true: ? B aggregates A objects. ? B contains A objects. ? B records instances of A objects. ? B closely uses A objects. ? B has the initializing data that will be passed to A when it is created (thus B is an Expert with respect to creating A). B is a creator of A objects. If more than one option applies, prefer a class B which aggregates...