CSC/ECE 517 Fall 2012/ch2b 2w64 bg

From Expertiza_Wiki
Jump to navigation Jump to search

Strategy Pattern, Directory of sites

Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found here. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.

Strategy Pattern, Getting Started

Now that you know the basic definitions and concept of the Strategy pattern, this will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.

To gain further insight into the working of the Strategy Pattern, this resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.

Patterns make the code better readable and easy to maintain. There are some difficulties when design pattern are not used. This article gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.


Strategy Pattern and Switch statements, a comparison

This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.

Strategy Pattern and Inheritance, a comparison

This is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.

Application

This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code or example but demonstrates the importance of strategy pattern in real life.