1. From macros to aspects
: macros and aspects are the code-based transformations
: macros use explicit invocation vs. aspects use implicit invocation
2. Separation of Concerns
: a concern is a specific requirement or consideration that must be addressed in order to satisfy the overall system goal
https://effectivesoftwaredesign.com/2012/02/05/separation-of-concerns/
- Crosscutting concerns and the "Tyranny of the Dominant Decomposition"
: a concern cross-cuts a design if its implementation spans multiple code units
: cross-cutting concerns are typical for large systems and cannot be untangled simply by a system re-design
https://rapptobias.wordpress.com/2014/03/24/the-tyranny-of-the-dominant-decomposition/
: cross-cutting concerns are common
e.g. logging, exception handling, error checking, load balancing, security etc
https://en.wikipedia.org/wiki/Cross-cutting_concern
http://stackoverflow.com/questions/23700540/cross-cutting-concern-example
3. Fundamental Idea of Aspect-Oriented Programming
- Isolate cross-cutting concerns as separate code units called aspects
- Apply code generation techniques to distribute the aspects over the base code
https://en.wikipedia.org/wiki/Aspect-oriented_programming
https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html
https://en.wikipedia.org/wiki/Aspect_weaver
4. Join points describe where or when cross-cutting concerns materialise
: a join point is a point in the program execution where a cross-cutting concern might intervene.
- static join points described by code patterns
- dynamic join points described by control flow
https://en.wikipedia.org/wiki/Join_point
http://www.eclipse.org/aspectj/doc/next/progguide/semantics-joinPoints.html
5. Pointcut descriptors formalise and name sets of join points
: join points are a semantic concept, pointcut descriptors are a syntactic construct
: use pointcut patterns for description
- primitive pointcut descriptors for different join points
e.g. call / execution / get / set
- descriptors for static and dynamic join points
e.g. within / cflow
- combinators
e.g. ! / && / ||
https://en.wikipedia.org/wiki/Pointcut
https://eclipse.org/aspectj/doc/next/progguide/language-joinPoints.html
http://stackoverflow.com/questions/15447397/spring-aop-whats-the-difference-between-joinpoint-and-pointcut
6. Advice is code that belongs to cross-cutting concerns
: advice is a syntactic construct
: different relations between advice and base code
- based on relative position of advice
e.g. before / after / around / proceed
- based on a success of the base code
e.g. returning / throwing
https://en.wikipedia.org/wiki/Advice_(programming)
http://www.journaldev.com/2583/spring-aop-example-tutorial-aspect-advice-pointcut-joinpoint-annotations
댓글 없음:
댓글 쓰기