Skip to main content

Questions tagged [observer-pattern]

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.

6 votes
2 answers
138 views

I just carefully studied the observer pattern. And I wrote a demo snippet to better undertand it. I am not so sure that if it's the right way to define ...
John's user avatar
  • 469
4 votes
1 answer
108 views

I have written my own basic implementation of the Observer pattern. Please code review it as you feel. This is a one file implementation, and any feedback no matter how small is appreciated. One ...
Archie Payne's user avatar
5 votes
2 answers
231 views

The Observer Pattern is used here to notify changes in a Person's data. For example, when age changes, the value of can_vote() ...
prestokeys's user avatar
  • 1,401
2 votes
2 answers
494 views

I am writing an observer design pattern that is not too complex but I still feel there's a lot for me to learn about C++ be it little details (especially coming from C). A couple of observations: I ...
xyf's user avatar
  • 508
0 votes
1 answer
219 views

I'm new to pygame and tried to write my own Event Manager because I couldn't find a solution I was satisfied with. So I wrote my own inspired by the observer pattern: ...
lukstru's user avatar
  • 1,048
1 vote
1 answer
647 views

I often want to program in an event driven way, but classic implementations of the observer pattern often pose an ownership challenge, and they only get more difficult once multiple threads are ...
Blue7's user avatar
  • 373
1 vote
2 answers
106 views

For this task, I don't think that the Observer Pattern can be used in its classic form. Those who have received the requests and those who choose to accept the request are not the same group. Those ...
prestokeys's user avatar
  • 1,401
1 vote
1 answer
327 views

I've been experimenting with wiring up a vanilla web component in a reactive manner to a state box. The goal is that when something changes on the state object, the web component reacts. I realize ...
Jeff Putz's user avatar
  • 113
5 votes
3 answers
416 views

My attempt at a observer design pattern (I know using namespace std isn't good). I'm very new to design patterns. Everything is inline with class definition. Please tell me if I'm doing anything wrong ...
Asphodel's user avatar
3 votes
2 answers
758 views

I am working on a personal project in university where I am currently trying to make my own implementation of a generic observer pattern that I can use throughout my project. I would appreciate any ...
Emil Holmsten's user avatar
4 votes
1 answer
349 views

I have made a Body mass index-calculator using ViewModel and LiveData. Source-code of the MainActivity: ...
michael.zech's user avatar
  • 5,042
1 vote
2 answers
1k views

I am/we are using the observer pattern for many things in our application. I think it's time to create a reusable base class for these situations. Most implementations I could find only do something ...
Michael's user avatar
  • 13
3 votes
1 answer
576 views

I have an order model and a client model. A client has many orders, an order belongs to a single client. In the client model I keep track of how much money a client paid (...
Bogdan Ta's user avatar
3 votes
1 answer
167 views

I have created this interface as part of my C++ learning path. This post inspired me a lot. The idea is to use its concrete implementations to perform some actions before and after any change of the ...
EmaPrn's user avatar
  • 31
1 vote
2 answers
878 views

A simple implementation of the Observer pattern in rust. The Observable constructor (::new) is called with a subscription function which will be called every time ...
Luke Skywalker's user avatar

15 30 50 per page
1
2 3 4 5
7