Once a project gets big I switch to the Publisher/Subscriber pattern through a main Mediator rather than using the default Model/Collection change events.
That is to say that I cannot relate to your 4th/any hell level.
You mean like Bacon.js? I have not, yet. Looking at it now it seems that it is used for filtering/mapping/combining values?
The messages I send are more light weight and usually say "this has happened" to which a View would respond by re-rendering itself or its part rather then me directly passing whole Models and Collections around.
Comments
Once a project gets big I switch to the Publisher/Subscriber pattern through a main Mediator rather than using the default Model/Collection change events.
That is to say that I cannot relate to your 4th/any hell level.
Can you elaborate on this?
I would create a global mediator:
And then use it to listen to messages in Views: And fire them from Models/Collections: Instead of listening to changes on them: So I can plug & play different parts of the system together.Edit: A link from Addy Osmani: http://addyosmani.com/largescalejavascript/#mediatorpattern
Have you tried out functional reactive programming? How does it compare to the mediator?
You mean like Bacon.js? I have not, yet. Looking at it now it seems that it is used for filtering/mapping/combining values?
The messages I send are more light weight and usually say "this has happened" to which a View would respond by re-rendering itself or its part rather then me directly passing whole Models and Collections around.
Yup! It sounds quite a bit like your mediator: make a stream, send events in the stream, certain things respond to the stream.
Check out this talk: http://vimeo.com/68987289