We should have both.

I like subclassing when I change the basic implementation (data level), and hooks/callbacks/plugins where I need to
add code that responds to events of the basic web application flow.


That is not a clear sentence, but here is what I mean:
If I wanted to change sessions to store data in a database rather then memory I would sublclass session and replace the
method that persists the data.


If I wanted to trigger something to happen when the session starts (outside of normal session handling mechanics) I would rather write a event handler
that responds to onSessionStart()


Example:
So if I want to create a customer record and start clickpath tracking, that should be done in the context
of an event handler. If I want to store sessions in a database I would subclass.


'CustomClasses':     {
       'Session': 'MyPackage.MyModule:MySession' ,
       'Request': 'MyPackage.MyModule:MyRequest'
   }

'Interceptors': {
'Session_onCreate': ['MyPackage.Cart:MySessionEvents_onCreate',
'MyPackage.User:MySessionEvents_onCreate'
] ,
}


So I have lots of customization as to what happens when a sesion is created, but only way to create a session.

-Aaron


Ian Bicking wrote:


Geoffrey Talvola wrote:

I think I agree with you, Jason -- Webware should provide an easy hook to
swap in a subclass for a key class like Session and it shouldn't feel like a
hack. The Mixin stuff feels like too much of a hack, and adding a bunch of
hooks at specific places in the code just adds clutter.


Perhaps a setting in Application.Config could specify classes to use in
place of the standard classes:

'CustomClasses':     {
        'Session': 'MyPackage.MyModule:MySession' ,
        'Request': 'MyPackage.MyModule:MyRequest'
    }


I think this allows customizability, but not extensibility. It's customizable because you can alter the appserver without modifying the main source. But it's not extensible, because it can only be done once per installation for each main class.

Ian


------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss



-- -Aaron http://www.MetroNY.com/ "I don't know what's wrong with my television set. I was getting C-Span and the Home Shopping Network on the same station. I actually bought a congressman." - Bruce Baum




------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to