it's amazing how JavaScript is becoming the new java. everyone thinks that adding a ton of extra complexity in the guise of a simpler api will make it more maintainable. in this example you now have 4 events under the hood and two event dispatchers. but it seem simpler because you only "see" two and one dispatcher. while it may make things just a little bit simpler to maintain you may enter debug hell when there's bu…
writer of the article here: I simply cannot follow the argument about "added complexity" The use case defines the minimum amount of links you have to make, in this case 4. Now you have two options: You just roll with it (we used to do that), or you try to abstract away a few steps (we do this now with the dispatcher). The dispatcher here is roughly 100 lines of fairly simple, unittestable code, so I really cannot see…
A:
update;
notify B;
B:
update;
notify C;
C:
update;
notify D;
D:
update;
with D:
wait for C;
update;
C:
wait for B;
update;
B:
wait for A;
update;
A:
update;
The former is a clear sequential path, the latter builds up and then unwinds in a stack-like fashion. It's like the difference been non-tail and tail-calls.It's only a technical nuisance that one model needs to wait for the other to update.
I would certainly not view a sequence dependency that's critical to correct operation as a "technical nuisance" to be hidden away; it's an important fact.