Saturday, April 08, 2006

Practical AOP #1: Data-Binding Aspect for Web UI

ZK ( is one of the best XUL tool for Java that I've known. It's a very powerful framework working on server-side to render DHTML with Ajax capability. ZK is heavily based on MVC model, but I personally want to use the .NET-like data-binding feature in this framework. To avoid making changes direct to the ZK core, which is being maintained by its developers, I use AspectJ (1.5) to create the "data-binding" aspect.

However, I firstly started with OO approach in my development process. After I have some working code, I've tried to refactor the data-binding aspect out of the base code. During development, I've found that it is difficult to develop aspects without looking to the base source code. Because I need to ensure that my aspect weaves the base code correctly.

In my data-binding aspect, I have 5 pointcuts and 8 inter-type declarations.

I've finished the first version of zk-databinding aspect outside the ZK team.
With AspectJ 1.5 and Java 5, I can deploy my aspect to a Web container (tested with
Tomcat 5.5.16) and get the data-binding feature transparently.
Not surprisingly, the data-binding aspect works with ZK 1.1 and ZK 1.2 flawlessly.

No comments: