From: Idan Sofer Date: 2003-01-16T04:40:38+09:00 Subject: Re: [ANN] Radical 0.6 Aur辿lien DEHAY wrote: >>Hello and thank you for the feedback:) >> >> > >'Welcome. I think I will have a lot of questions these days :) > :-) >>A handler can be either be a class(in the case a new instance is created >>for each incoming request), or be given as an instance of a class(In >>this case the same instance is used for all the requests), and it main >>duty is to process the HTTP requests, so it's role is similiar to that >>of of a servlet. >> >> > >Ok. The term "persistant" is not the good one. I mean "persistant >across the lifetime of the server". > >In fact, we want to write a webboard in ruby. So we need to have a >class which manage the messages (with database connection or not), and >some classes to generate the backends (HTML, XML, WML) for the >clients. So, to have a correct management for the messages, I need to >have only one instance of this classe for the site. > >I wonder how put this classes in the Radical architecture. The backend >management would be done with handlers, but for the messages >management? > Well, in this case you might want to code the backend code as a singleton class, suppose: require 'Singleton' module MBoard class MBroadManager_ include Singleton [def bla...] end MBoardManager=MBoardManager_.instance end That's perhaps the best way to do things of this kind, and it's not specific to Radical(some people suggest writing a singleton as module but I dislike this approach, it's a matter of personal perference however). Then you have the templates(which are kind of pseudo classes, and might become real classes in the future, inheritence etc), and the handlers or scripts exeuted by RubyScriptHandler are the "bridge" that connects everything. Idan.