Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroFerrante committed Jul 22, 2024
2 parents 68bb9ef + d0dc366 commit 3a4b4be
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
23 changes: 21 additions & 2 deletions Decorator/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
**EN**
# Design Pattern Decorator

Modello di progettazione
Structural design model
> Allow adding and subtracting responsibilities at runtime
> Avoid complicating the Client with different methods for different operations.
## Structure
- **Component**: defines the interface for objects that can have responsibilities added dynamically;
- **ConcreteComponent**: defines an object on which you can add responsibilities;
- **Decorator**: maintains a reference to a Component object, forwards its requests to its Component object, can also do other operations before and after forwarding;
- **ComponentDecorator**: implements the responsibility added to the component;
![alt text](image.png)

- `super`: calls the constructor of the superclass and if it is to be used it must be implemented first.

---

**IT**
# Design Pattern Decorator

Modello di progettazione strutturale
> Permettere di aggiungere e sottrarre responsabilità a runtime
> Evita di complicare il Client con metodi differenti per operazioni diverse.
## Struttura
- **Component**: ' definisce l'interfaccia per gli oggetti che possono avere aggiunte le responsabilità dinamicamente;
- **Component**: definisce l'interfaccia per gli oggetti che possono avere aggiunte le responsabilità dinamicamente;
- **ConcreteComponent**: definisce un ogetto su cui poter aggiungere responsabilità;
- **Decorator**: mantiene un riferimento a un oggetto Component, inoltra le sue richieste al suo oggetto Component, puo fare anche altre operazioni prima e dopol'inoltro;
- **ComponentDecorator**: implementa la responsabilità aggiunta al component;
Expand Down
4 changes: 2 additions & 2 deletions State/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#DesignPatternState
# DesignPatternState
**Behavioral Design Model**
> Allows an object to change behavior based on its internal state at runtime, makes it appear that the object has changed class.
Expand Down Expand Up @@ -26,4 +26,4 @@
![alt text](image.png)

*[Alessandro Ferrante](http://alessandroferrante.net)*
*[Alessandro Ferrante](http://alessandroferrante.net)*

0 comments on commit 3a4b4be

Please sign in to comment.