Aspect-oriented programming has been gaining a wider audience of late, as enterprise application developers discover that AOP provides for more intuitive, extensible, and flexible middleware. With JBoss AOP, provided in JBoss 4, developers can write plain old Java objects (POJOS) and request complex services like transactions, security, and caching with just a few simple annotations. Sound too good to be true? Read on.
Pioneered at Xerox’s Palo Alto Research Center (PARC) in the late ’80s and early ’90s, aspect-oriented programming (AOP) has greatly influenced modern software development, from the latest research at IBM, to the tag-driven development nature of Microsoft’s .NET and C# environments. Indeed, AOP has been gaining an even wider audience of late: its research community is extremely active, a number of open source projects offer a wealth of implementations, and, as a natural complement to object-oriented programming (OOP), developers are discovering that AOP provides for more intuitive, extensible, and flexible middleware. If you’re an enterprise software developer, the combination of JDK 1.5, the newest release of Java, and JBoss AOP, available in JBoss 4, may just be the best thing since sliced bread.
An aspect is a common feature that’s typically scattered across methods, classes, object hierarchies, or even entire object models. For example, metrics is one common aspect. To capture useful benchmarks from your application, you have to sprinkle timing (often liberally) throughout your code.
However, metrics are something that your class or object model really shouldn’t be concerned about. After all, metrics — and, as you’ll see, logging, persistence, caching, security, and other system heavyweights — is irrelevant to your actual application: it doesn’t represent a customer or an account, and it doesn’t realize a business rule. It’s simply orthogonal.
In AOP, a feature like metrics is called a crosscutting concern, as it’s a behavior that “cuts” across multiple points in your…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: