Jean-Sebastien Delfino wrote: > Jeremy, > > Ok that helps, I have a few more questions
I snipped my original, comments inline. > > Do you mean that Reference is a specialization of an Autowire? Would > Reference extend Autowire? > Yes. Yes. My thinking is that a Reference is a specialization of an Autowire which adds a constaint that requires that a target URI for a provider be defined. This is a common enough usage pattern that we define a specific specialization for it. It is also possible to think of it the other way around: that an Autowire is a Reference with additional information that determines which policies must be applied. That seems easier as it just means that we extend Reference to support constraints. However, I think this isn't quite right when it comes to the concept of Configured Reference. An Autowire can have constraints on it that are not expressed in the contract for Reference but which are implicitly there in the selection of the provider. It's a very fine distinction and I've flip-flopped mentally on this over the years :-) > Who do you think would declare an Autowire? the app developer defining > the component type? or the app developer configuring a component or > placing the component in an assembly? I think it is the app developer defining the componentType. The constraints on the autowire express requirements that the client implementation has that are not defined by the functional contract (interface). Those constraints apply to every usage (deployment) of that implementation and so don't belong in the assembly (composition). However, the assembler needs to be able to supply values used by the system as it resolves the autowire. If you treat reference configuration as fulfillment of the constraint that a target URI must be supplied, then there has to be a way for the assembler to provide a value for the target uri. [[ note viewing wiring this way is not something we expect a user to do - they should just be able to wire a reference to a service. It's more of a view of how the internals work. ]] >> 1) the assembler must supply wires for every Reference the components >> have. However, there are many wires whose routing can be expressed >> as a set of rules (e.g. always wire a reference to the auditing >> service to a specific audit server) and for those it simplifies >> the assemblers job if they can automatically be wired by the system >> >> > > Are you saying that an Autowire is the expression of many wires through > a set of rules? Is it the assembler who specifies the Autowire rules? or > somebody else? > Kind of. To be precise, I would say that Autowire allows the expression of rules that constrain how a user or the system can wire the assembly. The actual wiring can be done explicitly by the assembler or implicitly by the system but in all cases the constraints must be met. I think the assembler follows rules specified by someone else. That someone could be the component implementor who uses them to express assumptions made by his implementation (like it needs to be able to call a service in the same transaction context). Or it could be someone responsible for business policies (like that all audit be done by a particular service). Or it could be done by the assembler to capture a set of "best practices" that they use. -- Jeremy
