This post originated from an RSS feed registered with Java Buzz
by Carlos Perez.
Original Post: Multiface Coding in J2EE
Feed Title: .:Manageability:.
Feed URL: http://www.manageability.org/blog/stuff/rssDisabled?portal_status_message=Syndication+is+Disabled
Feed Description: Random thoughts on the manageability of complex software.
JavaPro magazine has published a quite illuminating article "Separate Business Logic From Components". It's an article written by two veterans at ATG. ATG or Art Technology Group was one of the first developers of an application server, as a matter of fact, they donated their template language to Sun. That formed the basis of what we know today as JSP. In short, when someone from ATG speaks, I listen attentively!
The article describes an approach which they've coined as "Multiface Coding". It was designed to tackle the notorious complexity of developing using J2EE. They've chosen a code generation approach. I however find it interesting to analyze their approach from the perspective of component models and aspect oriented programming (AOP).
The authors tackle the problem of developing reusable business logic. They do this but writing the business logic in Java and then providing an XML description. The XML description is describes the inputs, outputs and "implicit" inputs of the method of a class.
It's interesting to study what they mean by "implicit" inputs. In essence they are objects are part of the execution context of the business method. For example, they could be database connections, these are looked up using JNDI or they could be services provided by the container.
The authors have essentially created a component model for their business methods. If you read my earlier blog "What's a Component Anyway?" you'll see that they've satisfied two of the five characterstics I've mentioned.
However, what's quite interesting is that they are employing this approach because of the realization that business methods crosscut across implementation. However, these business methods aren't aspects, they're the base objects. So, all you got to do is flip the axis and you'll realize that the code generator they describe is like an aspect weaver, it essentially wraps up business methods inside a J2EE implementation. Very similar to what ACE or JGenerator does.
So in summary, for any large scale J2EE development effort, componentize your business objects and build and weave in J2EE aspects.