Include Page | ||||
---|---|---|---|---|
|
Wiki Markup |
---|
{include:Header, Design} {scrollbar} |
Currently
...
events
...
are
...
handled
...
very
...
bad
...
since
...
everything
...
is
...
subscribed
...
to
...
everything
...
(Project
...
explorer
...
to
...
Model.DataItems.Added/Removed,
...
Folder.DataItems.Added/Removed,
...
etc.).
...
As
...
result
...
it
...
makes
...
things
...
very
...
difficult
...
to
...
manage
...
when
...
objects
...
are
...
added
...
/
...
removed.
...
Especially
...
when
...
these
...
subsciption
...
happen
...
in
...
external
...
plugins
...
(HABITAT,
...
Verkenner...).
...
Better
...
way
...
to
...
inform
...
containers
...
of
...
the
...
collections
...
is
...
to
...
inform
...
parent
...
about
...
changes
...
(INotifyPropertyChanged)
...
of
...
the
...
underlying
...
object
...
or
...
let
...
only
...
container
...
subscribe
...
to
...
collection
...
contained
...
in
...
it.
...
In
...
a
...
few
...
words:
...
Arrows
...
show
...
what
...
object
...
is
...
subscribed
...
to
...
what.
...
Allowed
...
Subscription
...
of events
Wiki Markup |
---|
events
{flowchart}"SomeHighLevelType" -> "IEventedList<SomeType>" -> "SomeType"{flowchart} |
Wiki Markup |
---|
{flowchart} "Gui Form containing instance of SomeType" -> "SomeType" {flowchart} |
Wiki Markup |
---|
{flowchart}
"Gui Form containing instance of SomeHighLevelType" -> "SomeHighLevelType"
{flowchart}
h3. * |
Anti-Pattern
Wiki Markup |
---|
* {flowchart} "Gui Form containing instance of SomeHighLevelType" -> "SomeHighLevelType" -> "IEventedList<SomeType>" -> "SomeType" "Gui Form containing instance of SomeHighLevelType" -> "IEventedList<SomeType>" [ label = "DON'T" ]; "Gui Form containing instance of SomeHighLevelType" -> "SomeType" [ label = "DON'T" ]; {flowchart} |
In
...
general
...
the
...
rule
...
is:
...
when
...
you
...
need
...
to
...
Subscribe
...
/
...
Unsubscribe
...
frequently
...
to
...
events
...
-
...
you
...
have
...
to
...
review
...
your
...
design
...
of
...
how
...
event
...
subscription
...
is
...
organized.
...
Consequences
...
for
...
DelftShell
...
- Refactor
...
- all
...
- subscription
...
- of
...
- events
...
- in
...
- ProjectExplorer,
...
- HABITAT,
...
- etc.
...
Points
...
of
...
interest
...
- INotifyPropertyChanging
...
- in
...
- .NET
...
- 3.5
...
- WeakEvent
...
- in
...
- .NET
...
- 3.5
...