Tuesday, July 31, 2012

I have decided to post some of my papers from class in hopes that my knowledge can be passed on to those of you looking to learn more about the world I am a part of.  This...is my passion ~Geek



Design Patterns
Abstract
            The purpose of this paper is to define, compare and contrast three software architecture design patterns, considering how or when they could be implemented, and why one method might be favored over another.  The Adapter, Factory Method, and Façade will be reviewed.  Before discussing these design patterns, structural patterns and creational patterns must be defined for clarity.

Structural Patterns
            Structural patterns define the make up of objects and manage access control to subsystems of objects.  In contrast to the architectural patterns that define an entire solution of subsystem, there are usually a number of structural-design patterns in a single framework (Hofstader, 2006).

Creational Patterns
            Creational patterns are concerned with the instantiation of objects.  The creational patterns focus on the composition of complex objects and the encapsulation of creational behavior (Hofstader, 2006).

Adapter
            The Adapter, a structural design pattern, converts the interface of a class into another interface clients expect ("Adapter Design Pattern In C# And Vb .net", 2012).  Functionally, the Adapter acts as the bridge for classes with incompatible interfaces to work together.  The four participants in this pattern are, the Target defines the domain-specific interface that Client uses, the Adapter which adapts the interface Adaptee to the Target interface, the Adaptee defines a existing interface that needs adapting, and the Client which collaborates with objects confirming to the Target interface.  The brilliance behind the Adapter pattern is that it can take incompatible classes from different libraries or frameworks and act as a translator between the two, morphing the data so it can be manipulated by the Client.  The Adapter design pattern could be an ideal solution when connecting legacy databases to newly created objects, such as in the aerospace industry where databases may be decades old and the data has to be accessed through a modern workstation.  The Adapter acts as the translator between the two frameworks so the Client can interact with the data and manipulate as necessary. 

Factory Method
            The Factory Method, a creational design pattern, defines an interface for creating an object, but let subclasses decide which class to instantiate.  Factory method lets a class defer instantiation to subclasses ("Factory Design Method Pattern In C# And Vb .net", 2012).    This pattern attempts to standardize the architectural model for a range of applications by creating a superclass, and delegating details to subclasses that are Client supplied, such as the case with assigning values to variables by way of user prompts ("Factory Method Design Pattern", n.d.).   According to "Factory Design Method Pattern In C# And Vb .net" (2012), there are four participating classes and/or objects participating in this pattern; the Product defines the interface of objects the factory method creates; the ConcreteProduct implements the Product interface; the Creator declares the factory method, which returns an object of type Product; and the ConcreteCreator which overrides the factory method to return an instance of a ConcreteProduct.  The Factory method can aid in design customization with minimal increase in complexity to the overall product.  Where other design patterns require new classes, the Factory Method only requires a new operation to introduce the new subclass into the superclass.  The Factory Method design pattern could be used to offer flexibility in creating documents of different classes but with the same basic properties as all documents.  The default template offered in word processing programs is an example of this superclass ideal where elements such as margins and fonts are predefined, which the user can further classify into a report or letter based on the values input into the subclass interfaces

Façade
The Façade Method, another structural design pattern, provides a unified interface to a set of interfaces in a subsystem.  Façade defines a higher-level interface that makes the subsystem easier to use ("Facade Design Pattern In C# And Vb .net", 2012).  This pattern attempts to provide a simple and uniform interface to a large subsystem of classes.  According to "Factory Design Method Pattern In C# And Vb .net" (2012), there are two participants in this pattern; the Façade knows which subsystem classes are responsible for a request and delegates client requests to the appropriate subsystem objects, and the Subsystem classes which implement subsystem functionality, handle work assigned by the Façade object, and have no knowledge of the façade and keep no reference to it.  An interface designed to access random segments of a complex subsystem, such as a relational database, could be created using the Façade Method to bring together all the details that need to be viewed in a singular interface, such as with an automobile manufacturer.  The factory floor must bring together the thousands of dissimilar components to construct a vehicle and developing a unified interface for all workers to access can make managing the production process, as well as the quality assurance process, easier because each subsystem (factory worker or robot in this case) can see what components have already been assembled to determine which subsystem is next in the manufacturing processes.  Accessing subsystems through a remote server could also lend itself to the Façade Method since there are a number of subsystems being utilized in the background that the user is unaware of.

Conclusion
            Design patterns exist to attempt to simplify the architecture process and assist developers in creating architectures that are easy to maintain or adapt.  The three methods discussed here are useful in their own way, and could all be used within the scope of a larger, more complex solution to achieve a cohesive system that can dynamically respond to users’ needs while minimizing administrative overhead and system complexity.  To say that one design method is preferred over another is a paradox because any design method could arguably be used in most situations, or they could all be used in certain situations and if implemented intelligently could result in a stable system architecture.


 References
Adapter Design Pattern in C# and VB .NET. (2012). Retrieved from http://www.dofactory.com/Patterns/PatternAdapter.aspx#inten
Facade Design Pattern in C# and VB .NET. (2012). Retrieved from http://www.dofactory.com/Patterns/PatternFacade.aspx#intent
Factory Design Method Pattern in C# and VB .NET. (2012). Retrieved from http://www.dofactory.com/Patterns/PatternFactory.aspx
Factory Method Design Pattern. (n.d.). Retrieved from http://sourcemaking.com/design_patterns/factory_method
Hofstader, J. (2006). Using Patterns to Define a Software Solution. Retrieved from http://msdn.microsoft.com/en-us/library/bb190165.aspx#sysptrn_topic2
instantiation. (n.d.). The Free On-line Dictionary of Computing. Retrieved May 28, 2012, from Dictionary.com website: http://dictionary.reference.com/browse/instantiation

...more to come...