# Implementation of the Observer Pattern

**URL:** <https://discourse.julialang.org/t/implementation-of-the-observer-pattern/4230>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 12, 2017, 4:22pm UTC](https://discourse.julialang.org/t/implementation-of-the-observer-pattern/4230 "2017-06-12T16:22:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapus95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rapus95/32/3773_2.png) [@rapus95](https://discourse.julialang.org/u/rapus95)\
**Post date:** [June 12, 2017, 4:22pm UTC](https://discourse.julialang.org/t/implementation-of-the-observer-pattern/4230/1 "2017-06-12T16:22:42Z")

</div>

Right now I try to implement the Observer Pattern (or even the Event Pattern). But right now I’m unable too decide what would be the Julian way for it since I don’t have OO. Thus my main question is what the type tree should look like.  
Though performance is not critical I try to implement it the best way in regards of “type resolution”.

Theoretical use case would be a game that fires given events in the game and a bunch of listeners that react to given types of events.  
For the different types will I go for a single generic type with a symbol parameter? or abstract subclassing?  
Every event needs the ability to provide additional data like an Entity that is related to the event or maybe even a time stamp. In fact it should be able to store an array of Any.

Now do you know any resources or examples or do you have some hints what way I should go?

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [June 12, 2017, 4:47pm UTC](https://discourse.julialang.org/t/implementation-of-the-observer-pattern/4230/2 "2017-06-12T16:47:01Z")

</div>

I’d assume some of your issues are adressed in [https://github.com/JuliaGizmos/Reactive.jl](https://github.com/JuliaGizmos/Reactive.jl). Maybe you can use directly or borrow implementation.
