Bindings, Platforms, and Innovation
This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.
Tracking change and innovation in the enterprise software development community
Posted by Srini Penchikala on Sep 08, 2008 07:30 PM
While many think of Aspects for cross-cutting concerns such as transaction management, caching, persistence, role based security etc, Ramnivas Laddad says another key value for them is as an enabler for Annotations for ordinary projects.
Annotations, added in Java SE 5.0 as Java Metadata facility (JSR 175), provide a way to add metadata to program elements. They are used to configure containers, describe persistence configuration, set security roles, and are defined by nearly every recent JSR standard. They also include a mechanism for adding custom annotations to the Java code, as well as providing a programmatic access to metadata annotation through reflection.
Aspect-oriented Programming (AOP) has been used to implement cross-cutting concerns ranging from simple a use case like logging to advanced use cases like application security and transaction management. Using Aspects as a way to implement annotation handlers is a different way to think of them than as the traditional architect's "cross cutting concerns" view. Ramnivas talked about leveraging Annotations with Aspects and AOP on using custom annotations to add cross-cutting behavior to Java applications. He discussed what metadata and AOP bring to each other. Metadata brings additional information to selecting join points where Pointcuts use annotations to capture join points. It also helps in creating loosely-coupled aspects in certain use cases. And AOP brings a systematic way to consume and supply annotations. Supplying metadata using AOP also gives the benefit of uncluttering code. Consuming metadata using AOP has several advantages over using Annotation Processing Tool (APT) option.
Ramnivas cautioned that the use of metadata to extend the Java language can be both powerful and dangerous. On the one hand, annotations allow us to add new features to the Java language without modifying the core language, thus making it an open language; in the best-case scenario, principled extensions could overcome some of the limitations of the host language. On the other hand, a nonstandard, ad hoc, or incoherent set of annotations could result in incomprehensible code.
One of the best practices of getting most out of AOP is to use to metadata to capture join points for cross-cutting concerns. Keep in mind that Annotations should describe what is true at the join point (condition) - not what should happen at those points (action). He also suggested that the developers use annotations that are already there (like @Entity, @Table, @WebService etc). Consider pointcut without metadata as the first choice and rely on programming elements themselves. Also, avoid implementation-specific annotations. It also heps to understand the cost and benefit of using metadata and AOP together. Metadata can be consumed in a variety of ways, and understanding these uses will help put the combination of AOP and metadata into perspective. Ramnivas covered some of the best practices as well as suggestions for developers on not going overboard with custom annotations in his AOP and metadata articles (Part 1 and Part 2).
The main design considerations in implementing custom annotations are what (metadata, behavior), when (compile time, run-time) and how (APT, Run-time Reflection, AOP) to apply the annotations in Java applications. John Heintz recently did a presentation on adding behavior to Java Annotations where he compared different design techniques to implement custom annotations in Java applications. John discussed byte code transformers, which include Aspects, as one of the three types of Annotation processing options.
InfoQ spoke with John about the role of Aspects in implementing custom Annotations. He said it's really just a balance of forces (engineering trade-offs) that should be taken into consideration when implementing custom annotations. He also mentioned that Aspect-based implementations for Annotations provide the most concise way to implement behavior for annotation and a centralized definition. But the developers must clearly document non-local semantics and the impact on the build or deployment tool-chain (compile or runtime weaving).
Give-away eBook – Confessions of an IT Manager
Open Source Middleware Reference Architecture Whitepaper
The Agile Business Analyst: Skills and Techniques needed for Agile
I wrote an article in 2004 on Aspect Oriented Annotations and reached the some of same conclusions.
Because of the fragile pointcut problem that is pervasive in most applications of AOP, I think constraining AOP to solely being an annotation enable might be a good thing.
Bill Burke
http://bill.burkecentral.com
Hi Bill, My experience has been the same. I have been using Aspects and AOP in Java applications for various use cases for last 3 years and I prefer Aspects to implement the Annotations compared to other approaches (APT, Reflection etc). I think Aspects are relatively less intrusive and less complicated (from the implementation stand-point) design solution for Annotation handling. -Srini
Annotations are not meta-data. Think about it. Annotations are embedded in the code, and the code must be re-compiled if changing an annotation.
Annotations *are* meta-syntax.
Both have their place, but being clear about the difference can avoid a lot of confusion.
This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.
This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.
This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.
This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.
This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.
After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.
IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.
Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.
3 comments
Watch Thread Reply