CSC/ECE 517 Summer 2008/wiki3 1 PF: Difference between revisions
Line 27: | Line 27: | ||
*[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design)#Pure_Fabrication Grasp OOD] | *[http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design)#Pure_Fabrication Grasp OOD] | ||
*[http://web.njit.edu/~gblank/cis683/Larman%20Chapter%2025.ppt GRASP Pure Fabrication] | *[http://web.njit.edu/~gblank/cis683/Larman%20Chapter%2025.ppt GRASP Pure Fabrication] | ||
*[http://www.ibm.com/developerworks/rational/library/jun07/cuellar/ the case for High Cohesion and low coupling] | |||
[[CSC/ECE 517 Summer 2008/wiki3 Assignment|Back to the assignment page]] | [[CSC/ECE 517 Summer 2008/wiki3 Assignment|Back to the assignment page]] |
Revision as of 09:39, 23 July 2008
Pure fabrication
Sometimes it is a good idea to introduce into a system an object that has no counterpart in the real world. This is called the pure fabrication pattern. Find examples of pure fabrication, and weave them into a narrative that can teach programmers when it is helpful and when it is not helpful to fabricate objects.
Introduction
Programming all code by a design pattern can make the code more readable and easy to manipulate in the future. What do you do when you don't have any patterns that actually work in the design? A pure fabrication is a class that does not represent a concept in the problem domain. It is specially made up to achieve low coupling, high cohesion, and the reuse potential only if needed. So in code where you need to put something in and you can't come up with a patttern to match it, it may be time to just write the code and worry about a perfect solution later.
How would you classify it
Pure Fabrication is one of the nine GRASP Patterns that help aid developers in assigning responsibilities to objects in your web applications and winform applications. These nine GRASP Patterns are found in Craig Larman's excellent book, Applying UML and Patterns, An Introduction to Object-Oriented Analysis and Design and Iterative Development. I have talked about a number of these GRASP Patterns already, which you can find at the end of the article
examples of code sequences that would be awkward
Conclusion
Sometimes its better to develop something that works better in your code but isnt a perfect pattern. The Pure Fabrication Pattern is where you add classes into your application to create high cohesion and low coupling. This usually will allow better code re-use from application to application. Depositories and Factories are very similar to pure fabrication, they help with object persistence and object creation. They delegate object reconstitution and creation to specialized classes so domain objects are mere data containers and behaviors that act on that data.