java - Differences between Proxy and Decorator Pattern -


can give explanation difference between proxy , decorator?

the main difference see when assume proxy uses composition , decorator uses aggregation seems clear using multiple (one or more) decorators can modify/ add functionalities pre-existing instance (decorate), whereas proxy has own inner instance of proxied class , delegates adding additional features (proxy behaviour).

the question - proxy created aggregation still proxy or rather decorator? allowed (by definition in gof patterns) create proxy aggregation?

decorator pattern focuses on dynamically adding functions object, while proxy pattern focuses on controlling access object.

edit:-

relationship between proxy , real subject typically set @ compile time, proxy instantiates in way, whereas decorator assigned subject @ runtime, knowing subject's interface.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -