Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the underlying design pattern behind AOP?

Had this interesting question being asked today and the arguments varied from Proxy to Wrapper to Decorator.

Thoughts?

like image 524
Nilesh Avatar asked Dec 01 '22 08:12

Nilesh


1 Answers

The short description of

  • Proxy: "Provide a surrogate or placeholder for another object to control access to it".*
  • Decorator: "Attach additional responsibilities to an object dynamically."*
  • Adapter (Wrapper): "Convert the interface of a class into another interface clients expect."*

Based on this, to me AOP looks like (a solution to the problem solved by) Decorator rather than Proxy - and definitely not Adapter.

*From the GoF book.

like image 140
Péter Török Avatar answered Dec 02 '22 22:12

Péter Török