The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

GDW90 (2) [Avatar] Offline
#1
Hi Chris,

My initial enthusiasm with your book has since been somewhat tempered by the lack of more complete examples and explanations.

Specifically, at this moment I'm trying to determine how to use POJO facades in the system I'm designing. The interactions between the presentation and business tiers in the Food To Go system all seem to involve the transition from one UI/object/set of objects (e.g. "Restaurant List" page) to another UI/object/set of objects (e.g. "Order" page), returning the new object(s) from the method call. I haven't seen any examples of interactions which initiate change(s) to the currently displayed object and don't result in a transfer to a different page/object (e.g. a simple "Edit" page).

Obviously, in these situations I could use the exposed domain model and call the object's setters directly but then I would lose the benefits gained with the POJO facade (i.e. encapsulation, centralized security/error handling/transaction management etc.). Also, without the facade it would seem that any complex business logic would have to moved to the domain classes.

On the other hand, if I used the pattern demonstrated with the updateRestaurant method in the POJO facade chapter, it would seem that a lot of overhead would be incurred from passing back an updated instance of the object in the xxxFacadeResult.

I'm a relative rookie to this and I haven't read the book cover-to-cover yet so I may be missing the obvious (my apologies if so). I've done a significant amount of research on this topic from a variety of books and web sites (including on http://groups.yahoo.com/group/domaindrivendesign/) but the information seems so scattered/piecemeal that I haven't been able to pull it together. Due to a very tight schedule, I was hoping that your book would fit all the pieces together for me so that I could more quickly make some design decisions. While your book contains some great information, I still seem to be missing some critical pieces. I do realize that this is a complex subject and no book can be completely comprehensive.

Any help would be appreciated.

Thanks,
Gary
ceracm (113) [Avatar] Offline
#2
Re: POJO Facade question
Gary

Let me try and answer your question.
A facade method's parameters consist of:
* user input
* session state stored in the browser or HttpSession
The return values consist of:
* Data to display - i.e what is required by the presentation tier
* session state to store in the browser or the HttpSession

A facade method only needs to return what the presentation tier needs to do its job. In the case of Food to Go application updateRestaurant() returns the updated PendingOrder because the presentation tier needs to display it.

If it already has the date then the facade does not need to return it. Of course, this might be tricky to do in a web application unless it has the data it needs lying around in the HttpSession.

I'd be happy to discuss this more. Send me an email chris at chrisrichardson.net if you want to do it privately.

Chris