![]() This article is part of our Java Design Pattern Series. ![]() We also known the Decorator Pattern as Wrapper. In terms of structure, the decorator design pattern is like the chain of responsibility pattern. At runtime, we can’t add new functionality or delete existing behavior - this is where the Decorator pattern comes in. Because we divide the functionality into classes with distinct areas of concern, decorator design patterns are most commonly employed to apply the Single Responsibility Principle. To expand the behavior of an object, we use inheritance or composition, but we do this at compile-time and applies to all instances of the class. The Decorator design pattern is a structural design pattern that uses abstract classes or interfaces with composition to implement (similar to the Adapter, Bridge, and Composite patterns). Other instances of the same class will be unaffected, therefore each object will have its behavior changed. The decorator design pattern is used to change an object’s functionality during runtime. ![]() After that, we’ll look at the pattern’s design advantages, usage, and disadvantages. It is one of the Structural Design Patterns.We’ll learn about this pattern is all about. ![]() In this article, we’ll continue our java design pattern study by looking at the Decorator Design Pattern. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |