I am reading a book that intoduce 23 design patterns. I can understand what they say ,But when start to code,I find that I not sure where should I Use thoes patterns。dose it come from experience? I cant get the point.

  • 0
    that means use them,record where they work good .and then if I meet the same scence, just Use the pattern again. if one pattern work bad
    i can try others until find a suitable pattern
  • 0
    @feint ya. And we always need to keep on refactoring so always start with writing a test case.
  • 0
    I think this is a common issue with design patterns, and personally I would suggest looking at other books / videos online if this one is leaving you confused... Alot of design pattern books give pretty bad examples and make it much harder to think when you would need to use them. Personally i feel the best way is to find something that shows you code for a requirement and the problems that come of it without a design pattern, then shows you how to implement the pattern... I found pluralsight to be most useful here
  • 0
    I personally could never read the Gang of 4 book, too technical and would require people which already faced those problems in the past. Head First: Design Patterns is the book I would recommend. :)
  • 0
    Try reversing it. Look at your code, try match it to a pattern. If you are close to it, you'll be able to grasp the concept.

    It's hard, without experience, to read a pattern description and find it's use. With all in life, things must be tried to understand.
Add Comment