|
|
|
|
|
by currywurst
4144 days ago
|
|
I'm really interested in how this model scales, so could you please explain a bit what was difficult to manage in pub/sub ? I would imagine that if your topics and channels are well-defined and documented in one place, and the modules also declare what topics they pub/sub, one would get clear boundaries for maintenance. Also, what do you mean by live-binding ? |
|
That's the problem. It's hard to get this done. Developers like to develop, it's like pulling teeth to get us to document things. I've found its much easier and faster to have a codebase that speaks-for-itself, in a way.
Don't get me wrong, we definitely do document things. But the miniscule things like implementation details are just too small to be worth spending time on.
We've been in production for about 7 years now. Our team has pretty much completely turned over in that time. Knowledge and conventions get lost, much better to have the codebase dictate how things should be done. A developer will read the code+comments before they read the documentation.
Hmm how to explain live-binding... Angular's $scope and CanJS' Observables are examples of live-binding. Basically, you can pass around a live-binding object and changes made to it in one module are immediately reflected in another. Whereas with a pub/sub model, you publish messages out to a hub and it is up to the module to decide how to react to the message.
A good example of how we use live-binding is with sessions. We have a global live-bound object that holds the session data. Each module that needs to use session info simply refers to this global object. If we perform an API call that returns 401 and kills the session, our API module kills the session object and all our modules immediately respond to this change. We don't have to declare any listeners, or subscribe to any pubs; we just use the object.