Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperblues committed May 7, 2014
1 parent 0a06860 commit 0b89578
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ When to use Aspects
-------------------
Aspects are used to encapsulate "cross-cutting" concerns. These are the kind of requirements that *cut-accross* many modules in your system, and so cannot be encapsulated using normal Object Oriented programming. Some examples of these kinds of requirements:

* ***Whenever*** a user invokes a method on the service client, security should be checked.
* ***Whenever*** a useer interacts with the store, a genius suggestion should be presented, based on their interaction.
* ***All*** calls should be logged.
* *Whenever* a user invokes a method on the service client, security should be checked.
* *Whenever* a useer interacts with the store, a genius suggestion should be presented, based on their interaction.
* *All* calls should be logged.

If we implemented the above requirements using regular OO there'd be some drawbacks:

* Code would be repeated in many places.
* Methods have extra parameters.
* ***(most importantly)*** Good OO says a class should have a single responsibility, however adding on these extra requirements means a class that's supposed to be only about, say, interacting with a store has to also do logging, security and recommendations. Not good.

Good OO says a class should have a single responsibility, however adding on extra *cross-cutting* requirements means a class that a class is taking on other responsibilites. For example you might have a **StoreClient** that supposed to be all about making purchases from an online store. Add in some cross-cutting requirements and it might also have to take on the roles of logging, security and recommendations.

* Our StoreClient is now harder to maintain
* These cross-cutting requirements are spreading throughout our app.

AOP lets us modularize these cross-cutting requirements again. As shown in the examples above cross-cutting requirements can be eithe technical or business focused in nature.

## Here are some concrete examples:

Expand Down

0 comments on commit 0b89578

Please sign in to comment.