Composition
←Older revision | Revision as of 05:21, 14 April 2011 | ||
Line 45: | Line 45: | ||
When using [[DI]] there usually is single, central authority that defines the [[injection]] ''context'' (aka [[Spring]]'s '''ApplicationContext''' or [[Guice]]'s module). True, it is often possible to merge multiple contexts into one, but this is not inherently present in the framework. One can do it ad-hoc, if needed, using own rules. | When using [[DI]] there usually is single, central authority that defines the [[injection]] ''context'' (aka [[Spring]]'s '''ApplicationContext''' or [[Guice]]'s module). True, it is often possible to merge multiple contexts into one, but this is not inherently present in the framework. One can do it ad-hoc, if needed, using own rules. | ||
- | On the other hand, [[module system]]s often spend great amount of effort to merge individual registrations (via [[ServiceLoader]], or other extension points) together. There is a defined registration place, a search policy, a way to order individual registrations. There is a recipe how to build the master context without knowing the individual pieces that contribute to it. Rather, the individual pieces can prescribe by using additional meta information how they shall be registered with respect to other pieces (if they are present). | + | On the other hand, [[module system]]s often spend great amount of effort to merge individual registrations (via [[ServiceLoader]], or other extension points) together. There is a defined registration place, a search policy, a way to order individual registrations. There is a recipe how to build the master context without knowing any details about the individual pieces that contribute to it. Rather, the individual pieces can prescribe by using additional meta information how they shall be registered with respect to other pieces (if they are present). |
Again, this is just another example, that [[modularity]]'s primary concern is [[distributed development]], while [[DI]] cares more about better organization of one's own code. | Again, this is just another example, that [[modularity]]'s primary concern is [[distributed development]], while [[DI]] cares more about better organization of one's own code. |