Compare and Contrast Design Patterns Essay Example
Compare and Contrast Design Patterns Essay Example

Compare and Contrast Design Patterns Essay Example

Available Only on StudyHippo
  • Pages: 3 (741 words)
  • Published: August 5, 2018
  • Type: Essay
View Entire Sample
Text preview

In the development of a software solution, either for an enterprise or a much smaller group of end users, there are generally two schools of thought on how to proceed. You could plan and develop a solution completely from scratch, relying on your project team’s understanding and innovative design abilities to solve all issues that arise from your development effort. Alternatively, you could make use of a design pattern that gives you a templateto follow towards designing a complete solution that solves different issues for different situations as they arise. That is the idea behind design patterns.

They are not complete solutions themselves that can be magically turned into code. But, they can be used as templates for solving development problems by using the fundamentals behind object-oriented design which define and use the r

...

elationships between classes and objects themselves, keeping them general enough to be reused over and over. As you can imagine, because they are generic, there are plenty of design patterns that exist. They range from the simple to the complex and each has its own pros and cons when deciding which to use in your development project.

What follows is a compare and contrast of a sampling of the variety of design patterns in existence. Adapter Design Pattern The first design pattern we will explore is the Adapter pattern, also known as the wrapper pattern. Generally speaking, the adapter design pattern converts one interface for a class or object into another, separate but compatible interface. This allows classes that would normally be autonomous of each, due to incompatibility to work together by supplying a specific interface to the end user, while

View entire sample
Join StudyHippo to see entire essay

still making use of the original interface as well.

The adapter does the conversion between the two interfaces, and also converts the data that gets used in the forms needed within the overall solution. The adapter design pattern works like a bridge between to vastly different interfaces, making their interaction seamless and easy to control. Factory Design Pattern Another of the many design patterns used during development is the Factory Method design pattern. The factory method pattern is described as an object-oriented, creational design pattern that employs the concept of creating objects without exposing the exact instances of those objects’ code to the client.

Instead the client is referred to the new object created through a common interface. Surprisingly enough, this particular design pattern is one of the most widely used, yet not a lot of developers are familiar with it. Primarily, the reason for this is because it is not included in the patterns described by the celebrated Gang-of-Four’s design patterns book. The advantages of implementing the Factory method are: AdvantagesDisadvantages ? Easy implementation? Violates open/closed principle ? Only requires small changes to code? Uses sub-classing ? Encapsulation? Implies tight coupling between class nd products Facade Design Pattern The Facade pattern is very commonly used by developers in the software engineering field. The facade design pattern employs a simple interface to a larger body of code, such as a class library. This makes your architecture more flexible, and also less vulnerable. The disadvantage of using the Facade pattern is that in certain cases an adapter is used for a particular interface and polymorphic (adaptable) behavior must be supported. Observer Design Pattern Yet another design

commonly used design pattern is the Observer or subscription pattern.

This design pattern employs an object called a subject, creates a list of subject dependencies (observers), and alerts the observers of state changes or updates by calling a method. An advantage to using the Observer pattern is that its implementation handles distributed events. A disadvantage of using the Observer design pattern is that the overhead for its implementation is sometimes high due to using buffered resources. Proxy Design Pattern Finally, the Proxy design pattern is also a widely used and very functional design pattern.

A proxy, in software design, is a class operating as an interface to another resource or object. This object can be a file, a queue, a network connection, or some other resource that is difficult to copy or clone. Due to situations where several copies of intricate objects must be used, the proxy pattern can make use of more lightweight design patterns to lessen the overhead need to maintain them. The advantage of using the Proxy design pattern is that multiple proxy objects can be created, all of which contain a reference to the original, just like pointers.

Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New