Return to site

🍃🎓 SPRING CERTIFICATION QUESTION: What is the concept of AOP?

· spring,java,vcp

What problems does AOP solve? 💡

What is the cross-cutting concern? 🔀

Name three typical cross-cutting concerns. 3️⃣

What two problems arise if you don't solve a cross-cutting concern via AOP? 🙅‍

Answer:

Concept of AOP:

The concept of Aspect Oriented Programming is to move secondary functionality (also known as cross-cutting concern or system-wide concern), scattered all over the code, to a single separate module or class. Examples of such secondary functionality are logging, transaction management, security, etc. This functionality is not central, it just surrounds the main business logic (core concern). In AOP terminology that separate module or class is called an aspect.

💡 Solved problems:

1. Code duplication decreases.

2. Business logic code is not scattered with non-related secondary functionality code (e.g. transaction management)

🔀 Cross-cutting concern:

Functionality is duplicated in different application modules, but not directly related to * business logic (e.g. logging).

3️⃣ Typical cross-cutting concerns:

- logging

- caching

- security

- transaction management

- application monitoring

🙅Problems without AOP:

1. Business and non-business logic get mixed. Code is harder to maintain and understand.

2. Code duplication, which otherwise could be moved to a separate class or package.

#spring #certificationquestion #vcp

Introduction to Spring AOP👉 https://www.baeldung.com/spring-aop