> And having references to sessionFacade.getFoo() everywhere is somehow > better than having references to session.foo?
I think you are getting stuck on the name 'sessionFacade'; 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). > That sort of session facade is not a coherent > object and having "sessionfacade" everywhere means you have not > encapsulated use of session scope at all - you've just required that > people call functions to get at data. It seems as though you are mixing concepts; a well designed object, and how it access an external scope. I believe that within a well designed object, it should not reference a scope it does not directly have access to and should use a façade to get access to that data. > The better solution is to consider what data you have in session scope > in the first place and encapsulate each piece of data in an object > that relates to that data. I agree completely. > You might have a user object in session > scope - encapsulate that knowledge in a userService (singleton). That > way you've encapsulated how the user is stored - none of your > application code knows about session scope (or sessionFacade!). I agree that the application should utilize a service to interact (in your example) a user, but again, I think the service should not access the session directly either, it should use a façade to access the session. > You > ask the service to perform operations on the current user and it knows > how to do that. It can even give you the user object if you want to > operate on it directly. That means your application code is only > dependent on a fully encapsulated service. It also means that you can > change how the user object is stored independent of any other data in > session scope (because that other data is encapsulated elsewhere) and > nothing in your application needs to change. I could not agree more. - Rich Kroll ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292285 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

