CSC/ECE 517 Fall 2010/ch7 7c DF: Difference between revisions
(→Usage) |
|||
Line 13: | Line 13: | ||
=== Factory === | === Factory === | ||
The Factory design pattern is another common occurence in systems design which makes use of the pure fabrication principle. In this pattern, a common factory class is used to create objects of the appropriate type. While the objects created by a factory are concepts in the problem domain, the factory itself exists only to abstract the process of object creation. This increases cohesion in the objects by allowing them to focus on their core functionality and reduces unneccessary coupling with services that need to create them. | The Factory design pattern is another common occurence in systems design which makes use of the pure fabrication principle. In this pattern, a common factory class is used to create objects of the appropriate type. While the objects created by a factory are concepts in the problem domain, the factory itself exists only to abstract the process of object creation. This increases cohesion in the objects by allowing them to focus on their core functionality and reduces unneccessary coupling with services that need to create them. | ||
== Summary == | |||
As one of the nine GRASP concepts, pure fabrication is sometimes referred to as a design pattern. However, it is really more of a general design principle due to the fact that it offers guidance on when it is appropriate to create new classes solely for the purpose of improving the overall system design. The influence of pure fabrication is seen in various widely used design patterns and implementations to create well designed, reliable, and reusable services across a variety of applications. | |||
== References == | == References == |
Revision as of 05:38, 1 December 2010
Pure Fabrication pattern
Introduction
The GRASP design patterns suggest methods in which the responsibilities of a system can be distributed amongst classes. One of these is the pure fabrication principle, which guides the creation of classes that are not directly represented within a system's problem domain. Pure fabrication indicates that such extra classes should be created when there are responsibilities that do not fit well within any objects. By fabricating these extra classes, the designer is able to maintain a higher level of cohesiveness with less coupling than would be the case if the responsibilities were relegated only to the classes directly related to the problem domain.
Role in Doman Driven Design
One of the most common situations in which the pure fabrication principle can be seen is domain driven design. This is a process for system design which focuses on the core model of the problem domain. It results in a hierarchy of abstractions, the highest level of which are aggregate elements. Each aggregation represents a top-level component in the problem domain and is manipulated by a set of services. These services implement responsibilities required by the system; however, they are distrinct from the model aggregations derived from the problem domain. As such, they are implementations of the pure fabrication pattern which are created during the design of the system to maintain high cohesion of the domain's aggregations while minimizing coupling between them.
Usage
Model/View/Controller
One of the most common uses of the pure fabrication pattern is in the model/view/controller (MVC) architecture. In this situation, both the model and the view are typically extracted directly from the system requirements which define both what needs to be processed by the system and how it should be displayed to the user. The system requirements also specify what actions the need to be implemented; however, the actual organization of such actions is left up to the system designer. As specified by the pure fabrication principle, the actions are extracted into controllers. This results in new classes created solely for the purpose of maintaining higher cohesion and lower coupling among the models and views.
Factory
The Factory design pattern is another common occurence in systems design which makes use of the pure fabrication principle. In this pattern, a common factory class is used to create objects of the appropriate type. While the objects created by a factory are concepts in the problem domain, the factory itself exists only to abstract the process of object creation. This increases cohesion in the objects by allowing them to focus on their core functionality and reduces unneccessary coupling with services that need to create them.
Summary
As one of the nine GRASP concepts, pure fabrication is sometimes referred to as a design pattern. However, it is really more of a general design principle due to the fact that it offers guidance on when it is appropriate to create new classes solely for the purpose of improving the overall system design. The influence of pure fabrication is seen in various widely used design patterns and implementations to create well designed, reliable, and reusable services across a variety of applications.
References
http://en.wikipedia.org/wiki/Domain-driven_design
http://en.wikipedia.org/wiki/GRASP_(object-oriented_design)
http://en.wikipedia.org/wiki/Service_(systems_architecture)
http://en.wikipedia.org/wiki/Service-oriented_architecture
http://www.ibm.com/developerworks/webservices/library/ws-soa-design1/