State Design Pattern

State Design Pattern

This article describes the State design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.

Introduction

The State pattern is a design pattern, used in software engineering to simplify large swathes of conditional code. Instead of a class having large chunks of code that only get executed under certain conditions (states), why not split it into derived classes that represent those states.

It is defined as a behavioral design pattern, because execution is performed by a selected derived class, depending on it funtion.

Return to Top


Benefits

This pattern helps to keep code tidy and reduce conditional processing. It enables the object to polymorph into another object.

Return to Top


Examples of the pattern

An example of this pattern would be in the definition of an art package toolbox. Each toolbox item (pen, pencil, brush) performs the same basic actions, but performs them in a different way (sharp line, fuzzy blob).

 

 

Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki
  • [Please contribute]

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.
  • [Please contribute]

 

 

Return to Top


Leave a Comment
  • Please add 7 and 1 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • XAML guy edited Revision 3. Comment: tweak

  • XAML guy edited Revision 2. Comment: tidied sections

  • XAML guy edited Revision 1. Comment: tweak

  • XAML guy edited Original. Comment: spell

Page 1 of 1 (4 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • XAML guy edited Original. Comment: spell

  • XAML guy edited Revision 1. Comment: tweak

  • XAML guy edited Revision 2. Comment: tidied sections

  • XAML guy edited Revision 3. Comment: tweak

  • Are these articles to be updated by members?

  • You are welcome to :)

Page 1 of 1 (6 items)