3 ms·
Isn't it possible to define all listeners / publishers in a declarative way which can be compiled to catch for this issues?
by eddd-ddde 3y ago
Isn't it possible to define all listeners / publishers in a declarative way which can be compiled to catch for this issues?
- berkes 3y agoYes. It is. And most pub/sub or Observer architectures and design patterns have the "loop" thing solved just fine. In fact, the GOF spend an entire paragraph on the problem of complex update semantics in "design Patterns" (1995) ch Observer p299. So, while it is a real problem, it's one that has been solved (for at least 29 years)
- djbusby 3y agoYes, I want to mention, since I was up-thread, it is solved but not all tooling or environment are setup for that. When the app is small you likely don't need it. And then it grows and you absolutely do. It's better, in greenfield to use framework/tooling that is ready for it.
- berkes 3y agoGood to hear you found it solved! > It's better, in greenfield to use framework/tooling that is ready for it. I don't really agree. Tooling, and even more so, Frameworks, come with giant trade-offs. Some are "paint-in-a-corner" trade-offs. So I would caution against pulling in a framework just to solve potential future issues. So much so, that I think it is one of the top10 things that will cause your project or startup to fail or get into serious trouble. It's really a form of "premature optimization".
- zero_shift 3y agoIn fact I solved a similar issue in my JS reactive micro library in just 500 bytes: https://github.com/jbreckmckye/trkl https://github.com/jbreckmckye/trkl
- briantakita 3y agoI was not aware of trkl. Well done! I wrote rmemo (Reactive Memo) which solves the same problems & is a similar size. Different semantics though. https://github.com/ctx-core/rmemo https://github.com/ctx-core/rmemo Nanostores is also small https://github.com/nanostores/nanostores https://github.com/nanostores/nanostores. And if you only need reactivity in the browser (not server side), VanJS is small & includes reactive primitives. https://vanjs.org/ https://vanjs.org/
- rrr_oh_man 3y agoThat looks great! Thanks for sharing!