AOP is best used for cross-cutting concerns, which are often non-functional requirements. But what's the difference between functional requirements and non-functional requirements?
A functional requirement is a requirement about what an application should do. This is manifested in a form that the user can easily observe. Business rules, UI logic, etc.
A non-functional requirement is a requirement about how an application should work. This is stuff that a user typically doesn't see (and probably doesn't care about). Logging, caching, threading, etc.
So here's a quick exercise for you:
Which of these are functional and which are non-functional? Why?
- Addresses should be US-only, ZIP Codes must be five digits
- Every method call should log its own name and arguments to a text file.
- When returning a list of Customers, only Customers the current user is authorized to see should be returned.
- When submitting a new Customer, it must be put in a pending queue for approval by an administrator.
I'll post my answers in a later post, but feel free to leave your answers in a comment.