I'm starting on a fresh new project--should I look at my spec and decide which design patterns to apply, or just come up with a general idea of organization and allow the patterns to emerge organically through refactoring?
In your experience, which technique will be most productive and have a greater chance of leading to clean elegant code?
I'm also wondering if there are design patterns out there that aren't defined by the GoF, but could be just as valuable? If so, what are some useful resources for informing myself about these?
You should grow your code organically, applying patterns as they fit. Matching up with patterns too early can lead to a lot of inappropriate code and so many layers of abstraction that the design becomes obfuscated. Witness any code you've seen that was written right after someone had discovered patterns for the first time ;-)
Unless a pattern seems to obviously jump out of the spec, I wouldn't necessarily try to pick something from GoF and hammer the problem until it fits the pattern.
It's better to conceptually understand the different levels of abstraction in your head and come up with a plan (not necessarily a popular design pattern) for how you will implement it. This is something you will get better at with experience. While knowing the GoF patterns will help you improve your ability to think about problems in terms of code design, they are not meant to be solutions to every problem, and artificially forcing your problem to fit into a design pattern can mean unnecessary complication and obfuscation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With