YOUR FEEDBACK
John Portnov wrote: This code does not work for me. I created a new website and a C# console applic...
AJAXWorld RIA Conference
$300 Savings Expire August 22
Register Today and SAVE!

SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


The EJB Advocate: SOA Applications Using Java EE
Implementing Loosely Coupled SOA Applications Using Java EE

Still too many options to choose from
Dear EJB Advocate,

Thanks.
I hadn't considered before now that services like JNDI and remote interfaces provide aspects of loose coupling. I can also see how we (as you put it) "tightly coupled" the idea of SOAP and MQ, and should try to separate them where possible. So it makes a lot of sense to treat the parsing and generating of SOAP messages like a service itself that is reused by the Web services servlet and the MDB.

But no thanks.

Before this discussion, SOA seemed pretty simple: every service exposed a SOAP/MQ interface. Now it seems that I have too many choices to think about, and since I am treating the SOAP message parsing and generation like services, why wouldn't I want to make a separate session bean to encapsulate them for reuse like you show in your figures?

I'm afraid that I am:
Still Disconnected

Not everything is a service: use the business model to decide
Dear Disconnected,
This discussion is a great example of what happens when you get down to the implementation details too soon. The EJB Advocate column, "Which type of EJB component should assemble the data returned by a service?" was important because it describes a top-down approach to defining services that tied them directly to the business process model. To summarize the essential details of that approach here:

1.  Develop a model of the business process, showing the major milestones in the lifecycle of an important domain object
a.  We used a state-transition diagrams for this model, where the states represent the milestones, and the transitions represent events that cause changes in that state. The transitions can be considered the services offered by the application (see Figure 5 for an example).
b.  We extend the state-transition diagram with UML "Actor" notation to show the owner of the object when it is in that state. The owner of the state is responsible for initiating the transitions, so drives the security model of the application (also see Figure 5).
c.  For each state in the business process, we also model the attributes of each domain object and the relationships between them needed to support the actions of the transitions. The notation we typically use is a UML class diagram (see Figure 6 for an example). Having separate diagrams for each state let us model the changing "shape" of the object over time. These diagrams drive the persistent data.

2.  Develop a model of the user interface flow, showing how a given actor from the business process will interact with the system during a typical "session."
a.  Like the business process model, we used a state-transition diagram, where the states indicate the screens and dialogs and the transitions represents the actual UI events, like menu items being selected and buttons being pressed. The actions associated with the transitions are specified in terms of business process transitions.
b.  Also like the business process model, we build a class diagram to show the data that must be visible in each state to support the various choices. The implication is that this data must be derivable from user inputs and drives the read operations on the services in a top down fashion.
c.  Unlike the business process model, we need not extend the state diagram with Actor notation, since the diagram itself can be thought of as a "day in the life" of a single user role.

This comprehensive approach insures that:

  • The right operations are grouped together into a service (all the transitions and read methods associated with a state in the business process lifecycle).
  • The purpose of each service is well understood (the actions are specified in terms of the related business objects).
  • The pre-conditions needed to invoke a service and the post conditions that can result are communicated (the current state and optional guards, as well as the next state are specified by the transition).
  • The user role responsible for invoking the service is identified (an actor is associated with each state).
None of this information is provided by a method signature regardless of where they are implemented, but this information is crucial to a good SOA. Otherwise, programmers will fall back on another tendency: when in doubt, build it over again. Since development costs are higher for SOA (to provide all the different mediators and adaptors needed for the completely loose coupling shown in Figure 4), this tendency against reuse can minimize the benefits.

To answer the issue in your reply about simplicity, none of this information forces you to expose the interfaces in a certain way, and the EJB Advocate has learned that simplicity is in the eye of the beholder. If you want to eliminate choices for the service developer, you can simply provide all of the "blue" components shown Figure 5 for each service:

  • A remote service interface to provide location independent synchronous Java EE client access to the service operations.
  • A MDB associated with each operation that provides asynchronous non-Java client access over a JMS compliant MQ implementation. Optionally, this or a different MDB can be coded to expect Java messages for JMS clients (to avoid the HTTP Parsing overhead).
  • A Web services servlet associated with each operation that provides synchronous SOAP over HTTP client access. For those worried about the number of unused components that this approach would generate, another approach to simplicity is to apply what the EJB Advocate likes to call client-oriented architecture (COA); give the client exactly what they need to use the service in a way most natural to them.
This COA approach requires looking at the details of the business process and UI models to pick the most likely candidates for each approach. For example:
  • Transitions between states in the business process lifecycle are likely candidates for asynchronous services, since there will be a change of "owner" for the associated domain object. For example, the submit method can simply change the state of the order to "submitted" in the open order application (we called this OrderEntry in the example above), and send a JMS message to copy it into the submitted order application (we called this one OrderFulfillment).
  • Transitions within states should normally be synchronous, since there is no change of owner. As an example of why these operations should not be asynchronous, imagine if you went to a book seller's Web application and had to poll or wait for a pub-sub event for the catalog to be displayed or an item to be added to the shopping cart! And for those that want to use a pseudo-synchronous style over an asynchronous channel, please, please, please, see Bobby Woolf's book on Designing Messaging Systems.
  • Only provide SOAP over HTTP or MQ for integration scenarios where you have non-Java clients or services involved.
The COA approach results in the components being developed "just-in-time," which is why the EJB Advocate likes to recommend it.

And a final point to address your question (why not treat everything like a service, even the transformations associated with mediators and adapters): the simple answer goes beyond the fact that there can be too much of a good thing. When developing SOA or COA Java EE applications, it is best to consider services as operations on the business process model. Services have to do with the functional requirements of the application. Mediations and the associated transformations are associated with the non-functional requirements like reliability, usability, efficiency, maintainability, and portability. If you treat the mediations or the associated transformations as a first class service, you eventually obscure the real purpose of the application.

I know this is a lot to take in, so do not hesitate to contact me on the details as you apply these approaches.

OK then,
Your EJB Advocate

Conclusion
The dialog in these exchanges show how Java EE provides a complete implementation framework for applications employing service-oriented architecture, with each component or API playing an important role in some aspect of "loose coupling":

  • Operating system independence is provided by Java itself because Java provides a write-once run anywhere language for components that decouples your code from the underlying operating system.
  • Implementation independence is provided by the Java Naming and Directory Interface (JNDI), with the ability to bind a logical name to an implementation at runtime.
  • Location independence is provided by remote interfaces using RMI over IIOP to stateless session beans or entity home methods that encapsulate the services. RMI/IIOP is a stateful connection that is relatively fast, but does not scale all that well.
  • Web server independence is provided by HttpServlets that can respond to the synchronous HTTP protocol. Unlike RMI/IIOP, HTTP is (normally) a stateless protocol that scales well, but does not perform as well due to the size of the messages and the need to create and break down the connection between client and server each time.
  • Application independence is provided by the asynchronous Java Messaging Service (or MQ for non-Java clients) and message-driven beans (for the queue handler).
  • Language independence is provided by using a standard message format like SOAP, whether it flows on RMI/IIOP, HTTP, or MQ. Thus, SOAP may be used by every component, but it is important to only use it when necessary.
We are willing to bet you can find others. The challenge is managing the tradeoffs associated with each. That should keep you busy until next year.

Resources

  • Java Platform, Enterprise Edition (JEE) specification (formerly J2EE); the '2' was dropped in order to separate the main concept of a Java platform for the enterprise from a specific version.
  • Enterprise Java Programming with IBM WebSphere, Second Edition by Kyle Brown, Gary Craig, Greg Hester, Russell Stinehour, W. David Pitt, Mark Weitzel, JimAmsden, Peter M. Jakab, Daniel Berg. Foreword by Martin Fowler.
  • Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions by Gregor Hohe and Bobby Wolfe. Has a number of really great patterns and anti-patterns associated with messaging applications.
About Geoff Hambrick
Geoff Hambrick is a lead consultant with the IBM Software Services for WebSphere Enablement Team and lives in Round Rock, Texas (near to Austin). The Enablement Team generally helps support the pre-sales process through deep technical briefings and short term Proof of Concept engagements. Geoff was appointed an IBM Distinguished Engineer in March of 2004 for his work in creating and disseminating best practices for developing J2EE applications hosted on IBM WebSphere Application Server.

YOUR FEEDBACK
Jan Naude wrote: Relating to Doug Smith's question: Doug, I think you misunderstand MVC. The components are: Model (data retrieved/manipulated by business rules) View (responsible for rendering/displaying relevant information to user) Controller - business logic that operates on/manipulates model to produce data to be displayed by view. The idea with MVC is not to mix business logic (i.e. Servlets/Struts actions) and presentation logic (jsp/html) in the same artifacts (components), because then you end up not being able to replace/change one without having to replace/change the other. JSF focuses more on easily developing the View part, while Struts concentrates more on Model and Controller and their integration.
Jose Arco wrote: Hi, Really interesting article. I have a related question. We have a web acces application based completly on Struts. Now we want to add a new funcionality based on JSF, the question is if we could have integration problems between both tools. Thanks in advanced
bill wrote: it would be nice to redo this comparison TODAY in 2007 and see what comes out. Struts2 has really added a ton to their side and JSF components have matured. I would like to see a modern comparison- as there does not seem to be one.
wildcat wrote: Hi, Yes JSF is the way to go. The thing which I like the most about JSF is the finer control given by the component based architechture which is the key for RAD tools..like .NET. Java is up there facing a string competition form .NET but hey JAVA will WIN.
Doug Smith wrote: Friends, this is going to sound like a really dumb question, but I am asking in all sincerity. While I understand the arguments to separate view (screen) from model (database & rules) & control (keyboard), I'm not sure I understand why I need Struts or JSF to do this. I can put code a View as a JSP, interact with the Model using Javabeans, and exercise Control using HTML or JSP directives. What exactly are the benefits using either Struts or JSF? The cost is obvious - another set of things to learn and configure. (Asked by a solo practitioner who doesn't work with graphic designers).
David Thirakul wrote: Very interesting article, thank you. We are currently working extensively with Struts for the presentation layer and are watching the progress of JSF with much interest because it seems to be the way to go in the long term. There is no doubt that JSF will take over as McClanahan stated himself when he was talking about migrating to JSF. (see http://www.theserverside.com/news/thread.tss?thread_id=29068). There's no new development on Struts as opposed to JSF which by the way is the answer to MS webforms. So to answer Tom's comment, yes there is overlaping and if you start a new project from scratch and want to compare struts and jsf, roland's article is very insightful. What I would like to point out also is that JSF seem to lack the ease of use and functionnality of webforms, that's why all the new development goes into JSF, there's a lot of catching up to do...
Roland Barcia wrote: Thanks for the feedback. Craig has a vested interest in both frameworks. There are features in Struts that compliment JSF like Tiles and the Validation framework. But just because they have some areas where they can work together does not mean I cannot compare them both. In this article, I focus on the Core of the frameworks and how they differ. I see very little benefit with the current Struts implementation to mix the Struts controller with the JSF components.
Tom Roche wrote: To speak of "JSF vs Struts" displays a lack of understanding of the different specializations of the two frameworks. JSF specializes in view, Struts in model and control. The two can be used together via the Struts-Faces Integration Library. As Craig McClanahan's inaugural blog post http://blogs.sun.com/roller/page/craigmcc/20040927#struts_or_jsf_struts_and points out: > For new development, here's the best strategy for determining what > to do: > * Evaluate the two technologies individually, to see if they satisfy > your requirements. > * If one or the other technology is sufficient, go ahead and use it > (it's easier to learn and use one technology rather than two where > possible); keeping in mind, however, the caveats about Struts HTML > tags mentioned above. > * If your requirements include unique features supported only by > Struts (such as Til...
WEBSPHERE LATEST STORIES . . .
IBM announced that Vantage Deluxe World Travel has increased sales and improved business operations since turning to IBM to run its Web site and online booking system. Since switching to IBM WebSphere Commerce software, Vantage Travel has reduced order-taking time by 80 percent and inc...
Red Hat CTO Brian Stevens, Citrix CTO Simon Crosby, Egenera CTO Pete Manca, Allen Stewart, Group Manager, Windows Virtualization at Microsoft, and Brian Duckering, Sr. Director of Products and Alliances at Symantec were the top industry executives who joined Jeremy Geelan in the 4th Fl...
Mike Neil is general manager for virtualization strategy in the Windows Server Division at Microsoft. Mike is focused on the delivery of the Windows virtualization technology, including Windows Server 2008 Hyper-V, Microsoft Hyper-V Server and Virtual PC 2007. Mike also directs the tec...
The AJAX for IBM WebSphere Platform Early Program is an optionally installable product extension for IBM WebSphere Application Server Version 6.1 and WebSphere Application Server Community Edition that offers targeted, incremental new features that can make Web applications running on ...
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be...
Unify announced the expansion of its Composer for Lotus Notes solution through a partnership with CASAHL Technology. Partnering with CASAHL extends the Composer solution to include an assessment of the Lotus Notes infrastructure in order to inventory, categorize and analyze the types o...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING WEBSPHERE NEWS
Today at the TDWI World Conference, IBM (NYSE: IBM) introduced new versions of two software product...