|
|
|
|
|
by xentronium
5003 days ago
|
|
Implementing such system is a very tough call, actually. As complexity of your application increases, you stop understanding what happens when. The arguments for and against pub/sub callbacks are basically the same as with rails Observers and Sweepers. I personally felt that their original code was not that bad. |
|
You're quite right, in the original code it's easier to see at a glance what happens in that particular action. However, over the span of the whole application it's much more difficult to see, say, all circumstances in which an activity update is triggered, or all the ways a user might get a gamification reward for doing something on the site. It was precisely the growing complexity of our app that motivated this change; we were losing the ability to keep control of (and test) whole important features of our site, such as mailout logic, gamification, etc. and so forth.
As I say at the end, I certainly don't recommend this as a catch-all approach; you've got to know your app and be aware of the advantages and disadvantages.