How to study design patterns?

I have read around 4-5 books on design patterns, but still I don't feel I have come closer to intermediate level in design patterns?

How should I go studying design patterns?

Is there any good book for design patterns?

I know this will come only with experience but there must be some way to master these?


The best way is to begin coding with them. Design patterns are a great concept that are hard to apply from just reading about them. Take some sample implementations that you find online and build up around them.

A great resource is the Data & Object Factory page. They go over the patterns, and give you both conceptual and real world examples. Their reference material is great, too.


I read three books and still did not understand patterns very well until I read Head First Design Patterns by OReilly. This book opened my eyes and really explained well.


My two cents for such and old question

Some people already mentioned, practice and refactoring. I believe the right order to learn about patterns is this:

  • Learn TDD
  • Learn refactoring
  • Learn patterns
  • Most people ignore 1, many believe they can do 2, and almost everybody goes straight for 3.

    For me the key to improve my software skills was learning TDD. It might be a long time of painful and slow coding, but writing your tests first certainly makes you think a lot about your code. If a class needs too much boilerplate or breaks easily you start noticing bad smells quite fast

    The main benefit of TDD is that you lose your fear of refactoring your code and force you to write classes that are highly independent and cohesive. Without a good set of tests, it is just too painful to touch something that is not broken. With safety net you will really adventure into drastic changes to your code. That is the moment when you can really start learning from practice.

    Now comes the point where you must read books about patterns, and to my opinion, it is a complete waste of time trying too hard. I only understood patterns really well after noticing I did something similar, or I could apply that to existing code. Without the safety tests, or habits of refactoring, I would have waited until a new project. The problem of using patterns in a fresh project is that you do not see how they impact or change a working code. I only understood a software pattern once I refactored my code into one of them, never when I introduced one fresh in my code.

    链接地址: http://www.djcxy.com/p/33648.html

    上一篇: 工厂更新创建的对象,实现此目的的任何设计模式?

    下一篇: 如何研究设计模式?