A software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
2
votes
1answer
46 views
Removing same event from listener
I have a myDiv.mousedown, window.mousemove, and window.mouseup event. I'm trying to organize ...
2
votes
2answers
57 views
Brightness adjustment control for multiple UI elements
I have an application that basically exists as a map and some controls. The controls change the look and feel of the map. I have a slider which is used to change the brightness, for example. At the ...
4
votes
2answers
88 views
TextBoxes for various number types
Is there a way I could somehow have all this classes condensed into one, while keeping the code as clean as possible?
They are all doing essentially the same thing, just for the different number type....
2
votes
1answer
54 views
Using a new thread to post to observers
I have implemented my own Observer pattern. I want to post my events in a new thread. This thread would simply call all the the observers/listeners with the posted event.
...
3
votes
0answers
32 views
Rust publish/subscribe channel library
I've written a simple multiple-sender multiple-receiver channel, but I'm unsure if my approach is the best way to do this. I'm not using multi-threaded primitives but instead wrapping around std's ...
7
votes
1answer
70 views
WindMIll Data Publisher using observer pattern
Problem statement : There is a windmill which collects and stores wind data for various cities. The data is maintained in an xml file by the aggregator part of windmill. Now I am trying to implement ...
5
votes
1answer
76 views
Simple event manager in Java
I have created a simple event manager and I want it to work properly in a multithreaded environment:
...
3
votes
0answers
70 views
JSON Data Observer
I wrote a small piece of code for observing changes on JSON object. Whenever there is a change in Object, it should trigger all the handlers with simplistic information about data change.
I am ...
1
vote
0answers
33 views
0
votes
0answers
26 views
Small implementation of an Observer in Python
Good Evening,
I wanted to start with the Entity Component System but for that I have realized I should have know some basic patterns.
So here is my implementation of an Observer. Later on I also ...
3
votes
1answer
94 views
Observer design pattern in Swift
The problem:
We have a set of mobile mechanics who are assigned specific zip codes. Each zip code has its own hourly rate. We want to increase and decrease these rates when the number of idle ...
0
votes
1answer
79 views
Long running in-process Publish/Subscribe class
I have a Pub/Sub class that will call Notify() when published and that Notify() could take around 10 seconds, so I need to make ...
1
vote
0answers
43 views
Command and observer pattern to build installer wizard
I've done this mainly as an exercise to understand these design patterns. I'm writing a theoretical install wizard which will allow users to select different options throughout, and have it execute ...
1
vote
0answers
67 views
JavaScript sound manager (singleton / static object using observer pattern)
I have some JavaScript code i would like your feedback on please.
My goals:
SoundManager should be a singleton/static class that has one instance.
...
1
vote
2answers
80 views
Observer pattern implementation in JavaScript
I'm working on redeveloping a running project, and the main goal is to enhance the JS code as much as possible.
I'm using the observer pattern to watch the window ...
1
vote
0answers
357 views
Observer Pattern with C# and Unity
I want to see if I used the Observer pattern correctly.
Right now I'm using a VolumeManager.cs that implements ISubject and a <...
5
votes
1answer
380 views
Message bus in C#
I wrote a MessageBus class whose only purpose is to deliver messages from object to object without direct link between them.
I encountered a problem with duplicate ...
3
votes
2answers
608 views
Custom Implementation of ObservableDictionary
I recently found myself in need of an IDictionary<TKey,TValue> implementation that was observable from a WPF UI. Since the .Net framework does not provide ...
3
votes
1answer
122 views
Implementation of observer pattern in web app to monitor an RSS feed
I implemented observer pattern and it will be great if someone can do review of my work and say what should be done better.
What is the problem. Application monitoring rss channel, if there is ...
7
votes
2answers
173 views
Observable Object Proxy
As a part of my (future) MVVM framework, I need to be able to detect changes on an object. To do this, I used the RealProxy, a C# object that implements Aspect ...
3
votes
1answer
388 views
RxJS Subscription Service in Webworker
Here is a plunker of my working demo.
I have the following code which I have created for a subscription service for data through a webworker. I was wondering if I was following functional-reactive ...
3
votes
2answers
108 views
Custom event handler in Javascript
In my web projects I often need a simple way to trigger callbacks defined somewhere else. Leaving jQuery finally behind me, I was missing their simple event system and tried to create my own. I'd like ...
3
votes
3answers
159 views
Observer pattern implementation in C#
In order to implement the Observer pattern in C#, one of the ways to go (at least, the one I chose) is to make classes that implement the IObservable<T> for ...
5
votes
2answers
359 views
Logic gates simulation
Following this post and this other post here we are with another review request. The code that follows contains the definition of logic gates (binary gates like the AND, OR gate, and unary gates like ...
2
votes
1answer
65 views
Class simulating a connection among two pins
Following this post and the one before that, here I am asking for a review on another piece of code: the connection among two pins. As usual, be merciless in your review. Here it goes:
...
0
votes
2answers
99 views
Observer pattern implementation
I'm reading Head First Design Patterns and I'm currently reading about the observer pattern. Is what I produced correct?
...
3
votes
1answer
398 views
Observable template in modern C++
I'm trying to create a modern template class for a generic observable:
...
2
votes
2answers
484 views
Observable Collection “Deep”
In a project of mine I needed a class "Document" to be able to notify any change in its fields. This class keep a collection of class "AnotherClass". Using an ObservableCollection for this collection ...
5
votes
1answer
421 views
Observer Pattern with an Observer observing multiple Subjects
Is the below a good solution for an observer to monitor multiple subjects. My only fear is that if an observer was monitoring a wide range of subjects then the update method could get quite large ...
2
votes
0answers
79 views
Updating the coordinates of items possessed by a moving person
A Person has coordinates and an Item has coordinates as well, and hence both are derived from ...
0
votes
1answer
148 views
Does Java need an Observable object with generics?
This is the follow-up question from here.
This is an Observable class similar to java.util.Observable. The difference is that ...
3
votes
2answers
2k views
java.util.Observable but with generics to avoid casts
This is an Observable class similar to java.util.Observable. The difference is that it uses generics to avoid casts. The ...
4
votes
1answer
825 views
2D board game: good Model part?
First time writing a big project in OOP. I am quite used to scientific programming but not to OOP, and even less to building GUIs. I am writing a 2D board game: the player can move on a map from tile ...
4
votes
1answer
726 views
Checkbox binding to change the ListView's items source
I am using a checkbox to filter some components on my ListView by changing the variable's content which is bound to this ListView...
2
votes
3answers
413 views
7
votes
3answers
2k views
Listening to modifications on variables
I am seeking advice on the efficiency and long term implications of various ways of capturing modifications to instance variables that I have tried implementing. Essentially, this is setup:
In my ...