Skip to content

Simple registry implementation #2

Closed
wants to merge 1 commit into from

2 participants

@maritz
maritz commented Oct 6, 2010

Hey,

so here is the very simple version that just stores and returns and nothing else.
Btw: I used the node.js standard of spaces for tabs. You might want to consider switching to that as well.

Greetings,
Moritz

@chetan51
Owner
chetan51 commented Oct 6, 2010

Hey,

That looks cool, but I was wondering what use-cases you had in mind for the registry. How would people use it, and why is it needed for an MVC project?

Thanks,
Chetan

@maritz
maritz commented Oct 6, 2010

For making all kinds of stuff easily accessible for all controllers without the need of endless requiring.
Pretty much every MVC framework i've worked with had one and I was lacking a mechanism like that anyways.

For example if you have a function that is used in several places throughout your controllers but doesn't belong in any of your models, you can put it in the registry and then retrieve it in the controller whenever you need it.

@chetan51
Owner
chetan51 commented Oct 6, 2010

Ah, I see. For that purpose, I had added support for Helpers, just like CodeIgniter has. Would you and other users prefer to also have a registry that you can put your own stuff in? Or do you think Helpers would be good enough?

I just wanna make sure that functionality that we add is necessary functionality, to keep the project lightweight.

@maritz
maritz commented Oct 6, 2010

Well you can also use a registry for things like configuration or setting application states and such.

But I see what you mean and it's totally up to you whether you want to include this functionality or not.

@chetan51
Owner
chetan51 commented Oct 6, 2010

Configuration is an important feature, which I agree cannot be achieved by Helpers only. I think the registry functionality would be better named Configurations, so that users can store plain values in it and store commonly used functions in Helpers. That way, both features will have specific use-cases, and their functionality won't overlap.

What do you think?

@maritz
maritz commented Oct 6, 2010

Sounds good. Just renaming registry to configuration then. Should I do it or will you do it together with the helpers?

@chetan51
Owner
chetan51 commented Oct 6, 2010

If we're going to call it configurations instead, do you think we should just have it used as Ni.configurations('test', "word") and res.ok("Hello" + Ni.configurations('test') + "!")? That might be more clear, especially since we won't be storing functions in it anyway.

@maritz
maritz commented Oct 6, 2010

Yeah, the example would have to be changed too.
To be honest I just put it there to make sure that it works. :D

@chetan51
Owner
chetan51 commented Oct 6, 2010

Okay, you can change your registry and send another pull request. I've already added Helpers functionality, and I'll add documentation for it and Libraries onto the README soon.

@maritz
maritz commented Oct 6, 2010

Done and closed. :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.