"What you're experiencing is premature enlightenment." - Tyler Durden

The Gang of Four specifically warns about this, and it's important to acknowledge that it's happening.

When people first learn about design patterns, they will immediately begin looking for places to apply them. They will do this and fail in some particular way, and in doing so, learn more about that design pattern or perhaps one that they don't know of, yet. The issue most people have is trying to solve a problem with a design pattern they just learned without understanding that it isn't an appropriate pattern. But, you have to do it wrong in order to learn why. Prepare to fail and learn from those failures. It will make you a better coder.

Your initial hunch is that your problem would best be solved by the Decorator pattern, but it very well may not be. The Decorator pattern has fallen out of favor in recent years, as many people believe it violates good OOP practices. It has its uses, but they're limited.

You should continue coding this using Decorator if you like, so you can discover what its limitations are. It sounds like you're already hitting them. It's possible that Strategy and Composition might be useful here, as well. Just understand that you won't understand until you code yourself into a corner a few times. :)

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to