[Nitro] Simpler configuration method?

George Moschovitis george.moschovitis at gmail.com
Sun Feb 4 12:34:57 EST 2007


>
> I don't really get the point you're making here. What reusability? If I
> set some attribute, I always know what attribute I'm going to set on
> what object. Why would I want to use a library without loading the
> library? Why would I want to configure something I do not use?
>

I have alredy explained this (maybe on IRC though). Let me give you an
example. You setup all your settings in a single configuration file:

conf.rb

Og.create_table = ...
Template.root = ...
...

For this to work you need to make sure that Og and Template are already
defined...

Lets say you want to use only the Template setting from a script you want
to  write. You  cannot reuse conf.rb (you will get errors along the line
that Og is not defined)

An alternative (that is supported in the  current implementation) would be
to define your settings like this:

Configuration.Og.create_table = ...
Configuration.Template.root = ...

The problems:

1. too long
2. Does not work nice with namespaces (ie
Configuration.My::Name::Space.setting = ...)
3. values are accessed like this:
Configuration.Og.create_table.value(notice the exta .value)

Thats why we need a better configuration system. Using global variables
would fix all the problems but we get objections ;-)
So until someone proposes something better (well ok, IOC may be better, but
I think it will make the code too complex...)  we will postpone the decision
for the future.

-g.


-- 
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070204/2ce661b1/attachment.html 


More information about the Nitro-general mailing list