Aspect-oriented Programming
Occasionally, a technique or feature in an application doesn’t seem to fit well in a
single object. Rather than being encapsulated once, it seems to need to “cut across”
many different parts of the architecture at once. Logging, error detection and handling,
workflow auditing, and caching are some examples of cross-cutting concerns that find their
way into most web applications.
Aspect Oriented Programming finds a home in the li3 in at least two main pieces of
functionality: filters
and strategies.
Apart from filters, strategies are often used as a way to implement many different ways to
accomplish a similar task. For example, the li3 session functionality is handled by the
Session class. You can configure that class to use a number of different storage engines,
each with it’s own storage strategy. For example, you can configure sessions to be stored
in memory either in JSON or Base64 format. Strategies create a cross-cutting solution that
can be applied to a class that’s been adapted to handle them.