I recently learned interpreter pattern. I found some similarities betweeen decorator and interpreter. They are in same group and have similar structure.
I look in this case: one nonTerminal behaviour and one terminal behaviour in interpreter. It seems very similar to decorator. There can be nonTerminal behaviour calling same nonTerminal beahviour and then calling terminal behaviour. This seems very similar to apply decorator over same decorator over objet.
Is decorator a specail case of interpreter?
Aucun commentaire:
Enregistrer un commentaire