Laurie Harper wrote:
> If you start using 'internal' identifiers in your events, your
> sandbox is leaking. Why go to the trouble of hiding the object
> types and decoupling everything if you're just going to couple
> it up again by exposing implementation details in string
> identifiers?
I think it's simply a matter of namespacing shared keys in a publish-
subscribe registry. It's not a matter of exposing implementation
details.
Of course your modules should be decoupled as much as is reasonably
possible, but a namespacing scheme like Jarek described ("keyboard-
>onSecretCodeEntered") seems reasonable. You don't have to know
anything about the keyboard module to listen for such events. For all
you know there is no module named "keyboard", but, through the
sandbox, you can listen whenever something generates this particular
event. The namespacing is not central, but it makes it easier. For
example, in an application that represents some card game, it's really
nice to be able to distinguish "deck->draw" events from "screen->draw"
ones.
-- Scott
--
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]