Tags » Design Patterns

Understanding strategy pattern by designing game of chess

Today we will try to understand Strategy Pattern with the help of an example.
The example we will consider is The Game of Chess. The intention here is to explain strategy pattern and not to build a comprehensive Chess Game solution. 441 more words

Design Patterns

Tic-Tac-Toe : Breaking up the work

In this post we will cover Model–view–controller (MVC) and how we will use it to make our code reusable.

Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces.

306 more words

Decorator Design Pattern


Attach additional responsibilities to an object dynamically. Decorator provides flexible alternative to sub classing for extending functionality.

Class Diagram:
Example from Text Book:

The following example taken from “Heads First Design Pattern” book. 7 more words

Design Patterns

Observer Design Pattern


Observer defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Class Diagram: 23 more words
Design Patterns

Tic-Tac-Toe : Requirements

We start the project by determining the requirements for the game. These requirements will guide our design so need to make sure they cover the everything we expect from the game. 148 more words


Transforming Collections with Decorators

Transforming Collections with Decorators

The Decorator Pattern

Ever since first learning the programming design patterns, the decorator pattern has been my favorite. It seemed such a novel idea to me, and so much more interesting than the others. 1,172 more words