Giter Club home page Giter Club logo

Comments (12)

swankjesse avatar swankjesse commented on June 2, 2024

I like graph roots but I don't love the word root because it's technically inconsistent.

A tree is called a rooted tree if one vertex has been designated the root, in which case the edges have a natural orientation, towards or away from the root. [...]

In Dagger, any node in the graph can be an entry point.

from dagger.

jameswald avatar jameswald commented on June 2, 2024

I thought about this today too, same concerns. What about injectPoints? This would align with callers of the inject() method.

from dagger.

swankjesse avatar swankjesse commented on June 2, 2024

Injection points are already defined to be the members with @Inject annotations.

from dagger.

jameswald avatar jameswald commented on June 2, 2024

Hmm I see... perhaps injectors would be more concise. I'm somewhat surprised that these objects can't be gathered at compile time. Perhaps it's for flexibility, to avoid a static annotation such as @Injector on the class, however, I could see myself using @Injector on all my classes that need to inject.

from dagger.

patrickbaumann avatar patrickbaumann commented on June 2, 2024

I've had to explain it quite a few times as well and I don't think the name is the sticking point so much as the concept. The name seems completely appropriate, I'd just recommend adding a few more examples to the docs and coming up with a more concise explanation (easier said than done, of course).

I've found that people pick the concept up quickest when I explain that an entry point is any class that makes explicit use of the ObjectGraph to be created or injected into (so that it's dependency tree can be validated). Simplified, it's any type that is passed into an .inject or .create call.

from dagger.

cgruber avatar cgruber commented on June 2, 2024

Patrick Baumann wrote:

I've found that people pick the concept up quickest when I explain
that an entry point is any class that makes explicit use of the
ObjectGraph to be created or injected into (so that it's dependency
tree can be validated). Simplified, it's any type that is passed into
an .inject or .create call.

Did you mean .inject(Object) or .get(Class<?>)?

from dagger.

patrickbaumann avatar patrickbaumann commented on June 2, 2024

Heh, yes. My bad. Shows how rarely I use it in my code base.

from dagger.

JakeWharton avatar JakeWharton commented on June 2, 2024

graphNodes?

from dagger.

swankjesse avatar swankjesse commented on June 2, 2024

I don't think graphNodes covers the current behavior because every dependency in a node in the graph.

It may help to consider the definition & purpose of entry point. An entry point is a type that is a legal argument to ObjectGraph.get() or ObjectGraph.inject(). We require these to be explicitly registered so that the entire graph can be known statically; otherwise types defined in @Provides modules is known statically but other types need to be created at runtime. Like Guice's JIT bindings.

Even if a node is not a graph root, we require an entry point for it if it's used in the two methods because otherwise code changes will have non-local effects. Removing a dependency may implicitly drop a node or series of nodes from the graph.

One other word that comes to mind is bootstrap. That's because the process of requesting injection from the object graph is a form of bootstrapping the application. For Android apps we need to do this in every module, but for most applications it should only happen in the main class.

from dagger.

crazybob avatar crazybob commented on June 2, 2024

I might call it "injects=..." The doc is "explicitly declares types this
module is capable of injecting."

Bob
On Mar 26, 2013 9:06 PM, "Jesse Wilson" [email protected] wrote:

I don't think graphNodes covers the current behavior because every
dependency in a node in the graph.

It may help to consider the definition & purpose of entry point. An entry
point is a type that is a legal argument to ObjectGraph.get() or
ObjectGraph.inject().
We require these to be explicitly registered so
that the entire graph can be known statically; otherwise types defined in
@provides modules is known statically but other types need to be created
at runtime. Like Guice's JIT bindings.

Even if a node is not a graph root, we require an entry point for it if
it's used in the two methods because otherwise code changes will have
non-local effects. Removing a dependency may implicitly drop a node or
series of nodes from the graph.

One other word that comes to mind is bootstrap. That's because the
process of requesting injection from the object graph is a form of
bootstrapping the application. For Android apps we need to do this in every
module, but for most applications it should only happen in the main class.


Reply to this email directly or view it on GitHubhttps://github.com//issues/154#issuecomment-15503308
.

from dagger.

swankjesse avatar swankjesse commented on June 2, 2024

+1 to Bob's suggestion. Let's do that.

from dagger.

swankjesse avatar swankjesse commented on June 2, 2024

#221

from dagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.