3 ms·
I always make the call on inline callbacks versus observers based based on whether they're critical for the model's state. If your representation of whatever do
by johnb 17y ago
I always make the call on inline callbacks versus observers based based on whether they're critical for the model's state. If your representation of whatever domain concept your model is doing relies on the behaviour in a callback - it belongs to the model. If not, in an observer.
The often suggested use for observers is for caching (which is a good example). In our big app, if the cache expiry doesn't happen the site will look a bit funny but the underlying transactional data is fine. Mixing those together wouldn't communicate the difference in how important they are.