As is virtually always the case, encapsulating something makes it easier to test. Likewise, how easy it is to test something is a good indicator of the quality of the design. If you have to create an application scope, session scope, or lots of other components just to test one thing, it means you probably need to refactor to reduce the dependencies. Components should know as little about the rest of the system or the context of their use as possible.
I don't have any articles on session facades specifically, but the underlying idea (encapsulation) is the same for any object. Any book or article on good OO design would apply.
Hope that helps.
From: ultra_blue <greg@...>
To: fusebox5@yahoogroups.com
Sent: Thursday, August 2, 2007 1:05:49 PM
Subject: [fusebox5] Re: Session Objects
Brian:
Thanks for the reply. I actually had a session facade manager class
written for this, but I wasn't sure what it was doing there. It's been
a while since I've been working on this code. It looks like it's
working -- I've been able to eliminate the need for session scoped
objects in my code, which is what I was really after.
So, no, I don't need to do double-checked locking since FB handles
application scope locking, and the session facade class handles
session locking.
I am a little unclear as to why this helps with testing, though?
Also, could you post links to some of your articles about session facades?
Thanks!
Blue
--- In fusebox5@yahoogroup s.com, Brian Kotek <brian428@.. .> wrote:
>
> Well first ask yourself if you really need to do double-checked
locking here. It probably can't hurt but it is also probably overkill.
>
> What you describe will work. Personally, I don't like referencing
things in the session scope directly all over my code. I create an
application- scoped Session Facade component and all requests that get
or set things into the session scope go through this singleton
component. That way knowledge about the fact that the session scope is
being used is encapsulated in only one place, in the Session Facade.
It's my personal preference since it helps limit the impact of future
changes and also makes things easier to unit test (I don't have to
actually enable the session scope for my tests to run).
(My original message snipped.)