[cdi-dev] [JBoss JIRA] Commented: (CDI-4) Need a way to provide ordering for Event observers (@Observes)
Pete Muir (JIRA)
jira-events at lists.jboss.org
Mon May 9 11:18:18 EDT 2011
[ https://issues.jboss.org/browse/CDI-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600737#comment-12600737 ]
Pete Muir commented on CDI-4:
-----------------------------
"Let's go back to the Portland Pattern Repository or the GoF Design Patterns book and check the Observer/Observable pattern. The whole idea/mechanism is built based on the paradigma that all the involved parties know NOTHNING about each other.
They don't. That's why I'm relying purely on qualifiers for ordering."
A magic number based solution introduces tight coupling between observers and is non-type-safe. The approach proposed by Mike does introduce an (optional) level of coupling, but not as strong as magic numbers and is type safe. To interleave an observer in a magic number scheme I must know the magic number of *all* other observers I must come before. To interleave in Mike's scheme I simply need to know the qualifer they are using (which is itself reasonably decoupled from the observer method).
In general this notion that a non-strongly-typed link between objects is gives looser coupling inherently is extremely flawed.
> Need a way to provide ordering for Event observers (@Observes)
> --------------------------------------------------------------
>
> Key: CDI-4
> URL: https://issues.jboss.org/browse/CDI-4
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events, Portable Extensions
> Affects Versions: 1.0
> Environment: All
> Reporter: Lincoln Baxter III
> Assignee: Mike Brock
> Fix For: TBD
>
>
> There needs to be a way to specify some kind of ordering for Event observers.
> Understandably, this is somewhat counter-intuitive to the general concept of observing an event, but there is going to be need for this in an upcoming JBoss project. While it can be done manually, it might be nice to have a built-in API.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the cdi-dev
mailing list