Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/11

Click to flip

11 Cards in this Set

  • Front
  • Back
What is a crosscutting concern?
A crosscutting concern is a functionality that spans multiple modules of an application.

eg. logging, authentication
What is a core concern?
core business requirements
What are the two main problems caused by non-modularised crosscutting concerns?
1) code tangling. Having to handle multiple concerns as well as the core calculation logic at the same time. This will lead to poor code maintainability and reusability.

2) Code Scattering. Repeat the same statements (i.e. logging) multiple times in multiple modules to fulfill a single requirement. Later, if the logging criteria change, you would have to modify all of the modules. Moreover, it is also hard to ensure that the logging requirement
will be implemented consistently. If you have missed a logging statement somewhere,
the overall system logging will be inconsistent.
What design pattern can you use to assist with implementing crosscutting concerns?
You can apply a design pattern called proxy to separate crosscutting concerns from core concerns.
Proxy is one of the 23 GoF (Gang of Four) object-oriented design patterns, which belong
to the “structural pattern” category.
The principle of the proxy design pattern is to wrap an object with a proxy and use this
proxy to substitute for the original object. Any calls that were made to the original object will
go through the proxy first.
What is a dynamic proxy?
It supports creating a proxy dynamically for any object.

Dynamic proxies are implemented with the Java Reflection API, so they can be used in a
more general way than static proxies. For this reason, dynamic proxy is one of the core technologies
used by Spring for its AOP implementation.
What is an advice?
The crosscutting action to take at a particular execution point is
encapsulated in an advice
What types of advices does Classic Spring AOP support?
1) Before Advice (before method execution)

2) After returning advice (After the method returns a result)

3) After throwing advice (After the method throws an exception)

4) Around advice (Around the method execution)
How are advices written using the classic Spring AOP approach?
Advices are written by implementing one of the proprietary advice interfaces
In classic Spring AOP, what interface do you implement to use before advice?
MethodBeforeAdvice
What interface do you need to implement for after returning advice?
AfterReturningAdvice
What interface do you need to implement to handle throwing advice?
ThrowsAdvice