Could you give me some basic demo?Thanks very much! 2011/7/19 Sam Foster <[email protected]>
> A simple, useful rule of thumb when considering architecture, is to > never have a object communicate directly with something it didn't > itself create. I.e. calling methods on objects that are assumed to > have been created also - bad thing. That's how I break down when to > call methods directly vs. when to use pub/sub. The thing that created > me should hand me a list of pub/sub channel names, or a prefix which I > can use to push out and listen for events. If 2 things need to be > connected, the connection is shaped by the thing that makes them. > > Following this simple rule reveals a lot of of hidden assumptions > which can later turn into bugs, and it makes for more testable code. > It also makes clear when you need some kind of a manager or controller > to sit above components and dispatch events, and hold the shared state > for the collection of objects it manages. > > /Sam > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
