On Thu, 2006-03-09 at 14:21, David M Johnson wrote: > On Mar 9, 2006, at 5:02 PM, Allen Gilliland wrote: > > i feel like we are still a little disconnected here. my approach > > will not alter anything about our ability to use the open session > > in view pattern. the only difference i see is the difference > > between these 2 code blocks ... > > > > old way: > > begin(); > > website.store(); > > commit(); > > > > new way: > > WeblogManager wmgr = roller.getWeblogManager(); > > wmgr.saveWebsite(website); > > > But what if saving a website is just one step in a multi-part > transaction? OK, scratch that. If you start by doing the analysis and > designing one of the new Manager interfaces, I think we'll have a > much better understanding of this proposed refactoring.
i'll just give the short answer now. usually things that are multipart operations are still part of a single logical operation. in fact, we already do this in some places. take a look at the UserManager.createWebsite() method. that is a logical method which wraps a series of persistence operations. so the difference would be ... old way (in struts action or servlet): begin(); // setup website website.store(); // setup template template.store(); // setup category category.store(); // etc etc commit(); new way (logical method in manager class): UserManager umgr = roller.getUserManager(); umgr.createWebsite(newWebsite, possible, other, data); when i use the new way i only care wether or not the operation succeeded and i don't have to think about the persistence implications because they are hidden from me. now if it turns out that we have way too many transactions that would need their own logical method in a manager class then maybe this approach won't work, but i believe that in most request/response cycles the operations are pretty isolated and simple. in most of them you are only creating/updating/deleting a single object at a time. -- Allen > > - Dave > >
