Chapter 11. Policy enforcement: keeping your design intact
This chapter covers
- Understanding AOP policy enforcement patterns
- Enforcing EJB programming restrictions using AspectJ
- Enforcing Swing policies using AspectJ
Imagine that you’re convinced public access to a data member of a class isn’t a good idea. Or, imagine that you’ve realized layered architecture is the way to go. Or, suppose you’ve just finished reading the Enterprise JavaBeans (EJB) specification and realize that the specification prohibits working directly with files from an EJB. Clearly, you’d like to ensure that the projects you work on don’t violate these principles and restrictions. What are your choices? You could send emails to your team asking them to check for these violations, or you could add this information to a knowledge base. But these solutions are hard to maintain. Even if you somehow manage to detect any violations, perhaps through regular code reviews, what if you start a new project with a new team? Educate them again? OK, you get the point.