Skip to main content

Terminology: aspect

March 04, 2012 mgroves 0 Comments
Tags: aspect terminology

I continue to try and cut through some of the confusion around AOP by providing simple definitions and examples of often obtuse terminology (see also: other terminology posts).

"Aspect" seems like the core term in "aspect oriented programming" doesn't it? An aspect is simply a way to indicate to an AOP tool: what and where. The "what" is the advice, and the "where" are join points.

Let's review the terms covered so far by looking at a very trivial example of AOP:

In that example:

  • The join point is "OnEntry", i.e. before a method is executed
  • The advice is the body of the OnEntry method (Logger.Write(...))
  • The aspect is the MyAspectAttribute class itself
  • The pointcut is a combination of the applied [MyAspect] attribute along with the join point
    • i.e. the complete pointcut is "before the MyMethod method of MyClass is executed"
    • in this illustration, it's a very specific pointcut, but useful real-world pointcuts would be broader
  • The cross-cutting concern is logging (haven't gotten to that term yet; what's the rush, it's only the name of the site!)
  • The weaving is performed by the PostSharp post-compiler (also haven't gotten to that term yet)

Looks like two more terminology posts to go. If there's a term that I'm missing or glossing over, let me know, and I'll write a post on it.

Comments

Matthew D. Groves

About the Author

Matthew D. Groves lives in Central Ohio. He works remotely, loves to code, and is a Microsoft MVP.

Latest Comments

Twitter