State Pattern. Problem The state pattern is a behavioral design pattern. According to GoF definition, a state allows an object to alter its behavior when its internal state changes. Strategy Design Pattern Intent. This is the best way for updating an object's state on all observers. If we see carefully the above State Design Pattern implementation, then we will found that there are many State objects created and destroyed. Strategy pattern also allows us to define a set of algorithms. Similarities between State and Strategy Pattern If you look at UML diagram of State and Strategy design Pattern, they both look very similar to each other. State pattern is useful when we want to maintain various states for a scenario in our program. Strategy Pattern. If you want to read in-depth tutorials on the patterns themselves then you can read them here – State Pattern tutorial Read State Design Pattern Tutorial and Strategy Pattern tutorial Read Strategy Design Pattern Tutorial. This pattern is closely related to template method. State Design Pattern. This type of design pattern comes under behavior pattern. There are also many other ways to implement a State Pattern. Welcome to my State Design Pattern Tutorial! In State pattern, we create objects which represent various states and a context object whose behavior varies as its state object changes. This article explains what is state pattern and how to implement state design pattern in C#. All other patterns (and much more) are available in our .NET Design Pattern Framework 4.5. The .NET optimized code demonstrates the same real-world situation as above but uses modern, built-in .NET features, such as, generics, reflection, object initializers, automatic properties, etc. Hope this will help. With strategy design, Java programmer … In computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Learn the State Design Pattern with easy Java source code examples as James Sugrue continues his design patterns tutorial series, Design Patterns Uncovered