Re: SessionManager

From: Date: Wed, 27 Jun 2001 15:07:45 +0000
Subject: Re: SessionManager
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-503@lists.php.net to get a copy of this message
On Wed, 27 Jun 2001, Jon Parise wrote: > > Future PEAR components can just use the native session_* > functions without incuring the overhead of calling class methods. > > I don't see what you're gaining between this: > > session_name('session_name'); > session_start(); > session_register('foo'); > session_unregister('foo'); > session_destoy('session_name'); > > ... and ... > > $session = new Session('session_name'); > $session->start(); > $session->register('foo'); > $session->unregister('foo'); > $session->destory(); Well how about this (rough idea): $sesMgr = new SessionManager(); $myFoo = new Foo("blah"); // construct a Foo object $mySesMgr->addVar("myFoo ", $myFoo); // register the object // ... perform actions with the myFoo object that changes its inner state Then you can get that object back from the session at any time, and can keep track of all of the registered variables more easily, since they're all in one place. Internally SessionManager will have an array that it registers with session_register(). In this array it stores all of the variables. > > In the end that wrapper class will be bug-free, saving the developer of a > > new Pear component that requires sessions a lot of work... > > Are you inferring that wrapping the existing functions in a class > are going to improve the quality of those functions? Aside from > some addtional type checking, I don't know how you could really > improve upon them. No that's not what I meant. The PHP-functions themselves are obviously not directly affected by a wrapper class around them. I meant: the frequent use of PEAR-class X will improve the quality of class X. Maybe I didnt explain my idea right, so I'm trying for a little while longer ;-) Byebye, Hans

« previous php.pear.dev (#503) next »