Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename DIG's graph to container #313

Closed
HelloGrayson opened this issue Feb 23, 2017 · 3 comments
Closed

Rename DIG's graph to container #313

HelloGrayson opened this issue Feb 23, 2017 · 3 comments
Assignees

Comments

@HelloGrayson
Copy link
Contributor

HelloGrayson commented Feb 23, 2017

The term "graph" collides with "application graph" and "object graph", which is a term that relates to the users set of shapes that must come together.

Using "graph" in DIG's terminology is problematic for the same reason that using the term "inject" was: these terms exist to describe user-land concepts.

Overloading these terms creates confusion. Consider the following phrase:

The proposal is that all deps in the application graph, including clients and handlers, get registered into dig's graph so that the full graph can be resolved.

Here I used the term "application graph" to mean "all the shapes in user-land that must be wired using DI". This is confusing because DIG has a term "graph", which overloads the graph with the things which must make their way into the graph.

My suggestion is to use the classical term for this: "Container".

All deps in the application graph, including clients and handlers, get registered into a DIG container so that the graph can be resolved.

This will prevent confusion and make it easier for users to understand and utilize the concepts in DIG:

// create a new dependency injection container
container := dig.NewContainer()

// register all shapes in the application graph
container.Register(...)

// resolve the application graph
container.Resolve()
@glibsm
Copy link
Collaborator

glibsm commented Mar 20, 2017

@breerly Sorry to drop the ball on this earlier, lets see if we can recover some momentum.

After some exposure to the demos/prototypes in the last several weeks, do you still feel like there is terminology clash? I personally haven't run into it as such and actually found that dig graph and application graph are sort of one in the same. I think calling it a container is a little too generic.

@HelloGrayson
Copy link
Contributor Author

HelloGrayson commented Mar 20, 2017

I do.

Container is the pre-existing term for this object. I've heard/seen it called an IoC Container as well.

Graph is used to refer to the users set of objects that must come together.

In other words, they use the container to build the graph.

@glibsm
Copy link
Collaborator

glibsm commented Mar 23, 2017

uber-go/dig#3

@glibsm glibsm closed this as completed Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants