H
H
Helcurt2021-10-02 15:26:17
Java
Helcurt, 2021-10-02 15:26:17

Can you give an example for using the decorator pattern?

I am doing my homework using the decorator pattern. I know the pattern very well, you can give an example for its use.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2021-10-02
@Radia

Caching, for example, is convenient to do. In the decorator, we go to the cache, if it didn’t work out, we call the method from the main class.
Retray logic can also be put into it

B
BorLaze, 2021-10-02
@BorLaze

Here 's a good explanation.
In general, there are quite good examples on this site on patterns - and not much text, and at the same time it tells in sufficient detail how, when and why one or another pattern should be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question