CSC/ECE 517 Fall 2012/ch2b 2w63 sp

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

The State pattern is a simple behavioral design pattern intended to represent the different possible states of an object. The following sites are those found to be helpful in understanding the pattern.

Directory of Sites

Wikipedia

The Wikiepdia article on the State pattern provides a small overview of the pattern and provides a pair code examples, in Java and pseudocode. The article also provides two diagrams explaining the class layout of the pattern and a basic FSM. The benefit of the article is that it provides quick examples and definitions for reference. The reader can gain only the most basic information about the pattern's intended purpose and uses through this site and is only a good starting point.

Provides: Simple definition, simple examples, some diagrams


Sourcemaking

Sourcemaking.com provides more information about the pattern itself than the Wikipedia article, including the intent, problem addressed, and structure of the pattern. The site provides a list of common qualities and rules of thumb seen when using the design pattern. This site's explanation of the pattern is much richer overall and it provides more examples in the same language than found on the Wikipedia article. The reader can see a much better introduction to the pattern through this site and gain a better understanding of what the state pattern is supposed to do, this is helped largely by the presence of multiple examples in the most commonly used languages.

Provides: Deep definition, multiple examples, one diagram

Blackwasp

Blackwasp.co.uk gives . The article also contains a very different example of using the state pattern in the form of a music player written in C#. The example is simple in its implementation but also helps to show how useful the pattern can really be. The reader gains a better implementation-based approach, that is seeing the pattern explained through a demonstration of code, than a theoretical approach (as seen in the Sourcemaking article). Readers who learn faster by seeing something in action or in code benefit from this site more.

""Provides: "" Expanded definition, unique coding example, single diagram