Some troubles of Decorator Pattern

Some troubles of Decorator Pattern
1. can sometimes add a lot of small classes to a design and this occasionally results in a design that's less than straightforward for others to understand.
2. got typing problems: people sometimes take a piece of client code that relies on specific types and introduce decorators without thinking through everything. Now, one great thing about this pattern is that you can usually insert decorators transparently and the client never has to know it's dealing with a decorator:
3. introducing decorators can increase the complexity of the code needed to instantiate the component.Once you've got decorators, you've got to not only instantiate the component, but also wrap it with who knows how many decorators.

你可能感兴趣的:(Some troubles of Decorator Pattern)