Câu hỏi phỏng vấn Spring
Câu hỏi

What is AOP?

Câu trả lời

Aspect-Oriented Programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) without modifying the code itself, instead separately specifying which code is modified via a "pointcut" specification, such as "log all function calls when the function's name begins with 'set'". This modularization allows behaviors that cut across many kinds of programs, such as logging, error handling, or security features, to be added to a program without cluttering the code core to the functionality.

AOP complements traditional object-oriented programming (OOP) by enabling you to apply common functionalities across various parts of an application in a modular way. The key unit of modularity in OOP is the class, whereas in AOP, the unit of modularity is the aspect. Aspects enable the modularization of concerns such as transaction management that cut across multiple types and objects, often referred to as "crosscutting" concerns[1][2][4][5][12][15].

In practical terms, AOP involves the following concepts:

  • Aspect: A modularization of a concern that cuts across multiple classes.
  • Join point: A point during the execution of a program, such as the execution of a method or the handling of an exception.
  • Advice: Action taken by an aspect at a particular join point. This can be done before, after, or around (i.e., both before and after) the method execution.
  • Pointcut: A predicate that matches join points. An advice is associated with a pointcut expression and runs at any join point matched by the pointcut.
  • Weaving: The process of linking aspects with other application types or objects to create an advised object. This can be done at compile tim...
middle

middle

Gợi ý câu hỏi phỏng vấn

middle

Name some of the Design Patterns used in the Spring Framework?

junior

What is a View and what's the idea behind supporting different types of View?

senior

What are some benefits of using Spring Transactions?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào