Wrapping SESSION system handle; good, bad or just plain ugly

Posted by Peter Judge on 04-Jun-2010 13:58

Subject says most of it: do you create wrapper objects for the built-in "handle objects" like SESSION or, I dunno, CLIENT-PRINCIPAL?

I'm largely simply curious; I'm somewhat ambivalent: on the one hand, it allows me to extend that object and have a consistent interface; other other, it seems like make-work (doing it just for the sake of doing it).

-- peter

All Replies

Posted by Thomas Mercer-Hursh on 04-Jun-2010 14:05

There are those who seem to want to wrap everything, just in case they need it, but there is also a good argument that generalization hierarchies should be no deeper than they need to be.  My sense is that I wouldn't wrap it just for the sake of wrapping it, but if there is some real purpose, something accomplished, then fine.

Posted by dlauzon on 07-Jun-2010 09:50

On our site, I've created a custom additional session object to be able to add properties (e.g. current user) that aren't available in the SESSION.

Posted by Peter Judge on 07-Jun-2010 09:55

dlauzon wrote:

On our site, I've created a custom additional session object to be able to add properties (e.g. current user) that aren't available in the SESSION.

So it's a complementary object for your custom stuff; you still use the SESSION handle for whatever it's got on it? (my thoughts lie in this direction).

-- peter

Posted by Thomas Mercer-Hursh on 07-Jun-2010 11:40

I see this as a question of cohesion.  Would you put those properties together in the same object regardless of source or wouldn't you?

Posted by dlauzon on 07-Jun-2010 12:26

So it's a complementary object for your custom stuff; you still use the SESSION handle for whatever it's got on it?

Exactly.

This thread is closed