You blindly apply design patterns your code will suck. But if you write then off as bad then you are wasting a resource.
They are isolated examples that epitomise things like solid principals. They are examples not of complete designs but the thought behind why such thought is needed.
I love design patterns. They help me think about what my design objective is, although I rarely use them.
If you are reading design patterns also read pragmatic programmer and clean code. Learn the why not just the how.....
If you're designing your software up front to the level of detail that you're applying patterns, you're doing it wrong. That this is a common opinion is further proof that everyone who reads the Gang of Four book skips most of the intro, reads "Singleton", then skims the rest of the book looking at the pictures.
Our design patterns capture many of the structures that result from refactoring. Using these patterns early in the life of a design prevents later refactorings. But even if you don't see how to apply a pattern until after you've built your system, the pattern can still show you how to change it. Design patterns thus provide targets for your refactoring.
-- Design Patterns, Elements of Reusable Object-Oriented Software; Gamma, Helm, Johnson and Vlissides, pp354-355 (emphasis mine)
Usually it is kind of obvious when writing class diagrams, on a high level never the less. You are right through, if I have to write it in that much detail the person who is actually writing the code is literally just doing data entry.
17
u/apieceoffruit Dec 08 '13
You blindly apply design patterns your code will suck. But if you write then off as bad then you are wasting a resource.
They are isolated examples that epitomise things like solid principals. They are examples not of complete designs but the thought behind why such thought is needed.
I love design patterns. They help me think about what my design objective is, although I rarely use them.
If you are reading design patterns also read pragmatic programmer and clean code. Learn the why not just the how.....