DELAPARRA
Index
Color
NL
Category: Programming paradigms

Aspect-Oriented Programming (AOP)

Explained by Updated

What is Aspect-Oriented Programming (AOP)?

Aspect-Oriented Programming (AOP): Some behaviour (logging, auth checks, metrics) needs to run around many unrelated functions. AOP lets you define that behaviour once, then "weave" it into chosen join points instead of duplicating calls everywhere. Aspect-oriented programming, or AOP, is a way of handling behaviour that many unrelated parts of a program need, such as logging, permission checks or performance measurement. You write that behaviour once and attach it to the places where it should run.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Aspect-Oriented Programming (AOP)

How is Aspect-Oriented Programming (AOP) used in practice?

Without AOP, the same few lines end up copied into hundreds of methods, and someone always forgets one. With AOP, a rule like "time every repository method" lives in one file.

What should you keep in mind with Aspect-Oriented Programming (AOP)?

Java's Spring framework is the best-known user. In other ecosystems the same idea appears in smaller forms: HTTP middleware, decorators in Python and TypeScript, and event listeners in Laravel. Those are usually the better choice, because they are easier to see when reading the code. Use full AOP only where the cross-cutting behaviour is truly everywhere.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with A

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.