I have read and seen many examples describing why decorator is a structural pattern. And how it's composing objects to add new functionalities. While Visitor pattern helps with adding new functions to an object. And strategy pattern is to swap algorithm at run time.
I still can't wrap my head around the concept of why decorator pattern is a structural and not a behavioral pattern.
Can someone exemplify these patterns with few real world programming examples? The pizza and flying duck examples makes me think that I understand, but in a while I end up with - what did I just read.
Would be really helpful to take a real system design, spilt into smaller problems and apply all these design patterns.
Aucun commentaire:
Enregistrer un commentaire