Multiple Observer patterns?

Hi all,

how do you deal with multiple Observer patterns in an app?

Do you really have to make separate ObserverInterface / SubjectInterface pairs for each Observer pattern or is there some clever way to define the Observer pattern just once and reuse it multiple times?

TIA

Markus

I’ve done it the first way and don’t reuse the interfaces. YMMV.

Well you could have a second interface type that aggregates the first
This kind of acts like “subclassing” the interface

[code]interface i1
end interface

interface i2
aggregates i1
end interface

class class1
implements i1
end class

class class2
implements i2
end class

dim c1 as new class1
dim c2 as new class2

if c1 isa class1 then
break
end if
if c1 isa interface1 then
break
end if
if c2 isa class2 then
break
end if
if c2 isa interface1 then
break
end if
if c2 isa interface2 then
break
end if

if c1 isa class2 then
break
end if
if c1 isa interface2 then
break
end if
if c2 isa class1 then
break
end if

[/code]