开发者

What is the underlying design pattern behind AOP?

开发者 https://www.devze.com 2023-02-10 04:32 出处:网络
Had this interesting question being asked today and the arguments varied from Proxy to Wrapper to 开发者_运维技巧Decorator.

Had this interesting question being asked today and the arguments varied from Proxy to Wrapper to 开发者_运维技巧Decorator.

Thoughts?


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.


"the arguments varied from Proxy to Wrapper to Decorator."

Correct. That's why they give it a new name -- Aspect-Oriented Programming -- not just an OOP design pattern.

If it could be reduced to a single design pattern, it wouldn't last long in the marketplace of ideas.

The point is to take viewpoint that's a bit more broad.

0

精彩评论

暂无评论...
验证码 换一张
取 消