<< Don'ts | Home | The Mac mini Is Here >>

Brian Gilstrap on Dependency Injection

Brian Gilstrap: I believe the problems we have with dependency resolution (which dependency injection attempts to solve) are not the real problem, they are the symptom. The real problem is that we ...

Go read.



Re: Brian Gilstrap on Dependency Injection

Do you understand what Brian is talking about?

Re: Brian Gilstrap on Dependency Injection

He wants runtime identification of objects by name as well as by type. He wants the wiring of objects to be done by name as well as by type. And he wants it to be done by the language runtime.

He wants the runtime name to form a hierarchy like the runtime type form a hierarchy, although it could be a completely different one.

In Java, the language supports the construction of objects (calling the constructor) and the use of objects (calling methods, assigning to fields, etc.). The "wiring", such as done by Spring, is simulated with either construction (constructor injection) or use (setter injection).

He probably wants the language to openly support the concept of "wiring."

Of course I could be completely wrong.

Re: Brian Gilstrap on Dependency Injection

I find Weiqi's notion of 'wiring' interesting, though I haven't settled on a particular implementation idea. What I think we need is a way to think and talk about Java objects in a VM at runtime in terms of 'geography'. There should be some notion of the 'location' of an object, and the 'containment' of objects. For example, my house is in my city, which is in my county, which is in my state, which is in the United States. Note that this is not about the java package of an object. It's about the runtime 'location' of the object. This would allow us to do lots of useful things, like have location-specific logging. I think my latest post on the subject makes things a bit clearer.

Re: Brian Gilstrap on Dependency Injection

I think something like the CORBA Naming Service (or possibly the Trader Service) addresses this issue although it may be more heavyweight than what Brian is suggesting. The Naming Service lets you find objects by name within a context. The contexts can be arranged in arbitrary graphs, although a tree usually makes the most sense. [ and in practice most applications use a single - flat context ]

Add a comment Send a TrackBack