The purpose of this paper is to compare and contrast five design patterns. An explanation of design patterns begins the paper. After the explanation are sections on Adapter, Facade, Factory Method, Observer, and Proxy. A conclusion completes the paper. Definition and Explanation
According to SourceMaking (2010), "In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design" (para. 1). Transforming a design pattern directly into code is not possible as it is not a complete design. Rather, a design pattern is a description or template for how to solve a problem with use in many different situations (SourceMaking, 2010).
Design patterns concern themselves with three primary uses or families. Families include creational design patterns, structural design patterns, and behavioral design patterns. Creational design patterns revolve around class instantiation. Structural design patterns are specific to class and object composition. Behavioral design patterns are about object communication. Adapter
Adapter is a structural design pattern. According to SourceMaking (2010), "Adapter is about creating an intermediary abstraction that translates, or maps, the old component to the new system" (Discussion, para. 3). In other words, Adapter allows for component reuse when implementing a new system. An analogy is attaching a composite to HDMI adapter between a gaming system and an HDTV. Without the adapter, the ability to display video in HD quality is not possible. Adapter works the same way, allowing for functionality between otherwise incompatible systems. Another word for Adapter is wrapper. In comparing with the Facade design pattern the difference is Facade defines a new interface and Adapter reuses and existing interface (SourceMaking, 2010). Facade
Facade, like Adapter is a wrapper and a structural design pattern. Unlike Adapter, the...