CSC/ECE 517 Fall 2007/wiki3 5 ns

From Expertiza_Wiki
Revision as of 01:13, 19 November 2007 by Ndokuzo (talk | contribs) (→‎References)
Jump to navigation Jump to search

Take the Creator pattern and catalog the information on it available on the Web. Explain how it is different from the Factory pattern. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.

GRASP

GRASP stands for General Responsibility Assignment Software Patterns (or Principles), and they are the common object-oriented design patterns or principles that assign responsibility to classes and objects. Some of GRASP includes Information Expert, Creator, Controller, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection, Protected Variations.

What is Creator Pattern?

Creator Pattern is one of the GRASP approaches, which is developed to find an answer to the question of "Who creates an object of class A?" in object-oriented systems. Creator pattern suggests that Class B should create an instance of Class A if

  • B aggregates instances of A, or;
  • B contains instances of A, or;
  • B records instances of A, or;
  • B closely uses instances of A, or;
  • B has the necessary information for creating the new instance of A.

Creator Pattern vs Factory Pattern

Information Available on the Web

The Creator Pattern does not have many information on the web at all. Most of the websites that we found, use the same approach and the same example for explaining the pattern. In addition to this most of the resources explaining creator pattern online are power point documents for some course's lecture notes which are prepared to be very brief. Here, we are presenting the websites that we think they do a better job than other resources that we found online.

"Wikipedia" is one of the good places to read, to get a better understanding of what GRASP is, and what patterns and principles are included in GRASP. It also briefly explains the Creator Pattern, and how it decides that which class should create instances of another class. It provides no examples that illustrates this principle so it is not the best site for Creator Pattern online.

"David Hayden"'s blog on Creator Pattern is again, very brief and straightforward in describing the pattern, he also provides one simple example about adding a new DataRow to a DataTable class.

"Craig Larmann"'s book, Applying UML and Pattern: An Object-Oriented Analysis and Design and the Unified Process, is an excellent book that has a thorough explanation on Creator Pattern and other GRASPs. Some of its sections are available online through google-books. This book explains the Creator Pattern and presents an example of a system with Sale, SalesLineItem and ProductSpecification objects and it discusses how it uses Creator pattern to decide which class is responsible for creating new instances of SalesLineItem. Surprisingly, many of the sources that found online (most of them are lecture notes on object oriented design from different universities), use the example provided in this book for explaining creator pattern, so in our opinion, this is one of the best sources that one can read to learn and understand more about the Creator pattern.

"Lecture Notes" on GRASP from Augustana College describes the creator pattern briefly and gives the Sale example (which is originally from the book above), this website is a a good one that summarizes what is written in Craig Larmann's book, but it might not be the best place to start learning the Creator Pattern.

"Lecture Notes" on GRASP from Worcester Polytechnic Institute is the brief summary of what is explained on Creator Pattern in Craig Larmann's book.

"Lecture Notes" on GRASP from Napier University Edinburgh, also describes the pattern, and uses the Sale example. It also mentions briefly advantages of using this patterns and how it promotes low coupling.

"Lecture Notes" on GRASP from University of California San Diego explains the terminology used in Creator Pattern (for example: what "aggregates" or "contains" means), it also provides a different example about DatingRequest but the slides are very brief and they only contain the sequence diagrams of the system so it is not very clear what the example is about and how creator pattern is implemented in it.

"Lecture Notes" on GRASP from Inverhills Community College summarizes the whole points of the Creator Pattern in one slide, and also mentions about the steps of applying the pattern to the system. This slide might be a nice summary of the pattern as a whole but it's not necessarily a good place to start learning the subject.

"Lecture Notes" on GRASP from New Jersey Institute of Technology explains the Sale example and how creator pattern is applied in detail, this slides are again the summary of Larmann's book is mentioned above, but they summarize the book in detail so one can understand the example by looking through the slides, without actually reading the book.

"Marc Conrad"'s presentation has a brief discussion on Creator Pattern, also he presents a Deposit Item example which is an easy-to-understand example.

"Paul Christmann"'s lecture notes on GRASP pattern, also uses the example from the Larmann's book but the example is explained in detail and where the creator pattern is applied in the system is easy-to-understand.

"Lecture Notes" from Marist College and "Lecture Notes" from Kutztown University uses Monopoly game example for explaining the creator pattern, even though a person who knows about this pattern can understand what the example is trying to demonstrate, but the explanation of the example can be improved.

References

"Wikipedia" http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design)