design-patternsdecoratorflyweight-pattern

How do I use Decorator and Flyweight design patterns together?


In what situation is best used design pattern Decorator and Flyweight together.

I have a financial system to build and some friends showed me these standards.


Solution

  • Design patterns are not "standards". Design patterns are common Appropriate [vs. Anti-patterns] solutions for common problems. And usually you don't build entire system by using certain design pattern. Rather your subsystems in your code are preferably done by some pattern. Even Asp.net MVC is not really a pattern - it is a framework. But while you use it, your business layer can use many different design patterns to achieve its goals. For example, in the system I work on, there are many absolutely untestable areas developed without any patterns in mind. I started to use MVP, so my new code is testable. They live side by side in one system. Go to sourcemaking. It is explained there, when to use which pattern. And remember, that a pattern is just a general direction. Each implementation can be different based on the requirement. Your question is not specific enough to give you a good answer. We can discuss here about Decorator but without knowing what you're doing, this pattern may not be even good for you.