Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm learning Aspect Oriented Programming and have isues understanding concepts. I'm not a bad programmer but my english is bad and can't understand fully the definitions.

Can someone explain AOP concepts for dummies: join point, pointcut, weaving etc.

For example: Aspect: a modularization of a concern that cuts across multiple classes. What that means?

Thank you!

share|improve this question
add comment

1 Answer

Think of a concern as a functionality group e.g. logging, auditing, security

These functionalities are ever present in most code, but they don't really live in our animal->dog classes - they are functionality that should live in many classes - they are cross cutting concerns.

  • A Joinpoint is a place in the code where the aspect code is actually ran.

  • A pointcut is how to say what code runs at the jointpoint.

  • Weaving - is when the compiler/system takes your normal code and includes all the AOP code so that it triggers the correct code etc - can think of this as an extra pre-compile step.

A simple understandable example is:

  1. We want to track all method calls for debugging purposes (i.e. We want to see which methods get called in what order).
  2. We create an aspect that logs the name of the method when it gets called
  3. We create pointcuts that associate the aspect with all methods in the code. In most AOP frameworks you can do this easily with some wild cards
  4. We now have logging of every method ever called.

Please be aware that terminology differs slightly between different implementations and AOP frameworks.

share|improve this answer
    
Just as I was writing my lengthy answer! Yours is more concise, I like it. Will edit it slighty for clarity. –  Martijn Verburg Aug 8 '11 at 16:09
    
Thanks, I should learn the formatting rules, keep forgetting. –  Jonno Aug 8 '11 at 16:15
    
Seems like this would be simple to implement with Python decorators or Lisp macros- Y/N ? –  Paul Nathan Aug 8 '11 at 16:39
    
@Paul - not familiar with either construct you mention I'm afraid and a quick google didn't give me enough insight to answer either way. –  Jonno Aug 8 '11 at 17:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.