How do you apply design patterns?

Viewed 9703

From a bookish perspective, you might say that x design pattern is applicable in y scenario, but I want to dig a little deeper here. So here are my queries:

  1. When do you first decide that you'll use design patterns? Do all of you decide upon design patterns before coding?
  2. Are there any DPs that you apply after you're done coding (small refactorings)? Do you apply DP while maintaining code?
  3. What are the design patterns that are predominantly applied during design?
  4. What are the DPs that you apply while tweaking/refactoring code?
  5. Are there any hints in code (technical not functional stuff) that suggest that you should apply a DP (like too many ifs, double dispatch, multithreading)? If so, could you name the DPs and their catchpoints?
  6. Do you use any Micro-DPs that makes you feel good about the code you've written (even though others hate you for it :p)?

Edit:
I'd like to add that I read DPs through "Head First Design Patterns" and although it's one of the best books to understand the pattern. I don't think I've been able to transition the Pizza examples to real world scenarios.

I think this is one of the most influential books on DP but we can still have a book that may enumerate the various popular business scenarios that demand a particular pattern alongside that pattern. This knowledge is still implicit to a large extent I think. Such a book would be a very nice quick reference don't you think :))

9 Answers
Related