[Nitro] Simpler configuration method?

transfire at gmail.com transfire at gmail.com
Thu Jan 25 07:13:24 EST 2007



On Jan 25, 6:53 am, "George Moschovitis" <george.moschovi... at gmail.com>
wrote:
> > Yes, globals are indeed evil...Lars,
>
> can you please  explain me why are globals evils in this pecific usage
> scenario?

Imagine if you will a mod_nitro plugin for apache, rather than create
multiple execution spaces for each nitro app, single space is use to
improve preformace. In such a case global variables will be shared
between them and everything goes to pot.

This may sound off topic, but my introduction to OOP was mostyly via
Ruby. Only after all these years have I realized that Ruby did me a
great diservice in this regard by introducing me to Modules. Yes,
Modules. Not to mention open classes! Yes, by giving me all this rope I
have hung myself time again -- half the time not even knowing it.
(prototype-base opp aside) OOP is about classes and making instances of
those classes. And Global is for Classes. globabl variables are only
good for system wide information, like platform and load path, or
context driven vars like for regexp $1, $2, etc. Even then there use is
questionable.

So the reamification is someting like this:

  class MyServer < Server
    setting :root_dir, :default => 'public', :doc => 'The default dir'
  end

  my_server = MyServer.new

Alternatively you could reduce it to instantiating Server, though for
that you might want to change the parameters a little, in any case:

  my_server = Server.new( :root_dir => { :default => 'public', :doc =>
'The default dir' } )

T.



More information about the Nitro-general mailing list