Introduction

This handbook is full of examples to inspire usage and easier understanding of design patterns. What actually is a pattern?

Each pattern is a three-part rule, which expresses a relation between a certain context, a problem, and a solution. -- Alexander

When we start learning design patterns, we might tend to use them whenever possible. That can lead to over-engineering, which produces more code than it is necessary to implement the needed requirement. It is also called as over using of design patterns.

One way to escape over-engineering is to use Test Driver Development. TDD is made of 3 phases. First, write a simple test. Second, make the test pass, by implementing behavior that is required by the test. Third, refactor what we have coded to make the test pass. The third phase is the ideal place to think about design patterns, because when we want to refactor the code, we have a problem “how to make the code better?”. The design patterns are here to help us with problems, not to be a fancy toys to make our code better.

Always remember, when we use design patterns to solve code problem we face to, the intention is to lower complexity, never increase. That way we only produce low complexity code that is going to be readable and easily maintanable.

Interesting links and reference materials:

Last updated