I have started to study design patterns using some course in pluralsight and the gang of four book. While I feel I understand what I have studied so far, I think it would be very helpful if I would have some way of practicing them. I know that I will get the chance in time but I feel I would get a better understanding of each design pattern if I would do some exercises for each of them.

What I would like is if someone knows any websites or documents that provide exercises for implementing design patterns. I am particularly interested in ones where the author provides some source code and the problem that has to be solved and I have to implement a design pattern to solve it.

I am not interested in examples and theory; I already got that covered from what I am reading.

closed as not constructive by gnat, Martijn Pieters, thorsten müller, Kilian Foth, Blrfl Apr 8 '13 at 13:30

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.


I'm going to try and un-ask the question a bit.

When I was studying design patterns, I got my practical experience by trying to identify where I was using the patterns already in my own code and where I might usefully adopt a pattern to improve it. Using programs/problems supplied by someone else would just not be anything like as engaging.

On the other hand, the tricky parts about patterns are actually learning when to not use them. It is this understanding of the forces and consequences that is the key to being good at using patterns, and it is genuinely hard. (The other bits of a pattern are usually pretty simple.) Patterns are meant to be a way of thinking about good road-tested software engineering approaches, and for communicating this to other people, but too many use them as a crutch or straitjacket, believing that they must use as many patterns as possible and that everything has to be done with patterns. That's utterly foolish.

I still recommend writing your own code, not using someone else's. You need some actual ownership of the problem in order to really grasp the forces and consequences, and those are the part that you need to really learn to think in terms of.


The best exercise I can think is to to write a simple 2d game engine and something like tetris or pong on top of that.

Remember though, that it is important to know when not to use a patterns as well. Engineering just for the sake of it is not very cost effective.

Good luck!

(Incidentally, this interesting conversation is going on as well When should I use, and not use, design patterns)

Not the answer you're looking for? Browse other questions tagged or ask your own question.