On 10/29/07, Rich <[EMAIL PROTECTED]> wrote: > I think you are getting stuck on the name 'sessionFacade';
Only because that's what most people do *literally*. > I was attempting > to suggest abstracting access to the variable of which his components had no > direct knowledge. If my code is calling userService.getFoo() instead of a > reference to session.foo then I think that is absolutely a better choice to > utilize a facade. The added benefit of using the façade is that you can > unit test the service (by using a mock object). Totally agree. Using userService.getUser() as a facade for a user object stored in session scope is exactly what I'm advocating. > It seems as though you are mixing concepts; I'm not - but a lot of other people are! > I agree completely. > I agree that the application should utilize a service to interact (in your > example) a user, > I could not agree more. See, we're on the same page. > but again, I think the service should not access the > session directly either, it should use a façade to access the session. I think that's a pointless abstraction - see my response to Brian for why but I'll also elaborate here since this is an important point and a lot of people seem to be missing it. Only the service should know or care where the object for which it acts as a facade is stored. Introducing an arbitrary abstraction and then coupling most (all) of your services to that abstraction overcomplicates things and makes your code more brittle. Once a service has access to a generic facade like that, it can access *any* data behind that facade and the faux-encapsulation of the facade encourages developers to do so, believing they're using good OO practice. All that happens is you get increased dependencies because you've opened up a conduit to data that a service should not be able to touch. If a service needs access to data in another service, it should go through the *service* but with this generic facade approach, it can go directly through the generic facade, completely breaking the layering and encapsulation in the application. A session facade object - by any name - *breaks* encapsulation by allowing unrestricted access to *any* data for which it acts as a facade. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292305 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

