I've been pondering an issue with the Sheil/Cade worked example that I'm hoping some of you will be able to shed some light on. The class diagram in the part 2 worked example on page 172 of the study guide has the BidManager methods returning a bid object. Assuming the BidManager is a stateless session bean and so a facade to the business layer doesn't returning the a bid object back up to the presentation tier uneccesarily couple it to the domain model? Surely the presentation tier should be shielded from the domain model implementation by the business tier? If the example class diagram were implemented using JSF then the controller would speak to one or more managed beans acting as the model to the JSP views but the managed bean(s) that interfaced with the BidManager SSB would have to 'know' about the Bid class as it would be being returned to the managed bean(s) following a call to one of the BidManagers methods?
I'd be very interested in any of your thoughts on this.
Bid object is an entity acting as a Persistent object. Persistent object is a light weight entity which can be exposed to presentation tier. Persistent object when it is populated with the database value it can be deattached with EntityManager and can be used as normal java bean.
If you have any other intermediate class to expose it to the presentation tier, you will end up like having duplicate classes.
In Cade's example Bid Persistent entity can be used even if JSF is used along with JSP.
Thanks for your reply Kumar. In cades example, if he had had a managed bean between the ssb bidmanager and the controller the managed bean would have had a 'uses' dependency on the Bid entity to show that the managed bean used/had visibility of the Bid class?
Joined: Mar 12, 2011
yes, there will be uses stereotype between bid class and the managed bean.
chris J Smith
Joined: Dec 29, 2011
Thanks again Kumar. Assuming the Bid object returned by the BidManager class is used to render Bid data in one or more of the JSp views then surely there should be a dependency from the controller class to the bidmanager class in Cade/Shiel's diagram? Or is including dependencies such as this 'overkill' in terms of diagrammatically describing a proposed architecture? I'm stuck knowing how much detail to put into my part 2 class diagram.
Joined: Mar 12, 2011
The situation you are asking is similar to what is mentioned in the book. Its always better to follow the book example.
subject: Sheil/Cade part 2 example - coupling query