tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/821-nested-models-injection-best-practicesRobotlegs: Discussion 2012-02-29T11:48:26Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/136691002012-02-14T07:16:02Z2012-02-14T07:16:02ZNested Models - Injection Best Practices<div><p>In RL models aren't supposed to call remote services, not
directly and not through composed delegate classes. In fact
application models can be entirely different from domain models.
This is why we have the S in MVCS: services. You create services
that call the remote API and pass the returned data to commands
that in turn populate models if need be. The idea is to separate
the data model from the data retrieval method, since it makes the
system more flexible.</p>
<p>Then, core actors should in general never be responsible for
composing other core actors. This is what we have commands for,
that optionally can use factories if you need a centralized
composition mechanism.</p>
<p>And it's perfectly possible to have actors that need to be
configured and still use the auto DI. You can have constructor
injection or you can use the PostConstruct meta tag to have a
method automatically called after the injections.</p></div>creynders