Skip to main content
9 votes
Accepted

Angular 2 clock with RxJS Observable

Your service looks perfectly fine to me. As far as the Clock component goes, I can only recommend one thing. When ...
Igor Soloydenko's user avatar
8 votes
Accepted

Observer pattern written in C++

Overuse of abstract base classes In your code, you have way too many abstract base classes. Most of them are not necessary. In fact, you only need a base class for the observer. Its ...
G. Sliepen's user avatar
  • 61.7k
7 votes

Implementation of Observer Pattern in C++14

I'm not sure we really need a base Observable class to inherit from anymore, because with lambdas and function type erasure, this pattern has become more or less trivial. But if you want to do it ...
papagaga's user avatar
  • 5,767
6 votes
Accepted

Observer pattern using a set of observers and delegated properties

You don't need a wasPresent variable. MutableSet.add returns true if the ...
mfulton26's user avatar
  • 691
5 votes
Accepted

Scheduling using System.IObservable 2.0

1) int as time interval is ambiguous. TimeSpan is not. So I would use the latter. ...
Nikita B's user avatar
  • 13k
5 votes
Accepted

Angular service for fetching and passing data with observables

One of the improvements would be to use an HttpClient instead of Http for making the API calls. If you use ...
SiddAjmera's user avatar
5 votes
Accepted

Simple event dispatcher

Design Is there a need for IEventDispatcher? Defining it as an abstract base class doesn't provide much utility if there's only ever going to be one derived class. ...
hoffmale's user avatar
  • 6,508
5 votes
Accepted

Implementing the observer pattern for a stock exchange scenario

Make immutable class members const If you have a member of a class that is set once at construction time, but will never change, then make it const. For example, in ...
G. Sliepen's user avatar
  • 61.7k
5 votes
Accepted

Observer Design Pattern in C++ to model magazine subscriptions

Answers to your questions I know using namespace std isn't good [...] Please tell me if I'm doing anything wrong or if there is anything that can be improved. ...
G. Sliepen's user avatar
  • 61.7k
5 votes

Dependency problem with field changes

This is a tough one. I can see what you are trying to achieve, and your solution obviously works, but your own spider senses are already tingling that this is not the ideal solution. So why is that? ...
G. Sliepen's user avatar
  • 61.7k
4 votes

C++ implementation of the observer design pattern

Design Review Ownership One of the advances of C++ over is C is ownership semantics. We understand who owns an object (and thus who is responsible for destroying the object). We do this by using a ...
Loki Astari's user avatar
  • 96.6k
4 votes
Accepted

Java Pub Sub implementation using broker

First of all, mutex should be final, since you are synchronizing on it. In the current state of your code, it wouldn't make much ...
Stingy's user avatar
  • 2,138
4 votes

Generic Observer/Listener implementation in Java

API Besides the obsever management (add/remove one), an Observable should only expose a get() and a ...
Ralf Kleberhoff's user avatar
4 votes

Dependency problem with field changes

It's an interesting question, and the code is a little complex but not bad. Here are some things that may help you improve it. Initialize all members The constructor for Person initializes every data ...
Edward's user avatar
  • 66.6k
4 votes
Accepted

My C++ Implementation of the Observer Pattern

About the observer design pattern The design patterns from the "Gang of Four" focus heavily on solving problems using classes. However, in modern C++, there are other ways to solve the ...
G. Sliepen's user avatar
  • 61.7k
3 votes
Accepted

Scheduler built with observables

...
Xiaoy312's user avatar
  • 3,136
3 votes

Observable Object

Avoid convenience aliases unless it really improves the code You created the type alias enable_, but it is only used twice. Furthermore, if you wouldn't have seen ...
G. Sliepen's user avatar
  • 61.7k
3 votes

C++ implementation of the observer design pattern

Potential Bugs You don't define virtual destructors for Observer and Subject. This makes code such as ...
Ben Steffan's user avatar
  • 5,303
3 votes
Accepted

News reading application version 2

You were interested in a review in both the pattern as code style. Note: I'm addressing subscribers also as listeners and observers in this review. Code Style Prefer ...
dfhwze's user avatar
  • 13.9k
3 votes

Apply stock quote changes using observer pattern

1. If you are implementing this pattern for learning, then it is OK. Otherwise, you can use built-in Observer Pattern of C#. 2. Think about readable: ...
Nhan Phan's user avatar
  • 265
3 votes
Accepted

Notify observers when object attributes update

To give you valuable feedback on your usecase, I would need more information, like: How do listeners listen? How does the caller look like? How exactly does ...
Neo's user avatar
  • 316
3 votes

Generic Observer/Listener implementation in Java

Unit tests Dive into that; it is relative simple. Then you are doing TDD, Test Driven Development. You can keep those tests in the project, and future changes with regression errors then will be ...
Joop Eggen's user avatar
  • 3,616
2 votes
Accepted

Reusable Implementation of the Publish-Subscribe Pattern

Receiver Data is a placeholder denoting a generic type. In Java, generics are pointed out with a single-letter literal (most often, ...
Antot's user avatar
  • 3,657
2 votes
Accepted

WPF async ObservableTaskQueue class

So, there's a lot going on here. First things first, this class is really doing too much. It's running a queue of tasks one after the other, it's handling retrying errors, it's adding a delay ...
Servy's user avatar
  • 821
2 votes

Angular - reusing an observable for different queries

There's nothing (obviously) wrong with your code. You deal with observables the efficient way, IMO. Cache is good. The fact you're constructing a "base" observable in constructor without subscribing ...
Igor Soloydenko's user avatar
2 votes
Accepted

Observable Logger

The only issue I see is the Subject class implements IDisposable and should be disposed of. Which would mean your ILoggerFactory now needs to be IDisposable. (Taken from MS documentation) ...
CharlesNRice's user avatar
  • 4,408
2 votes
Accepted

Observable implementation

There is quite a lot of "almost similar" code due to the fact that you treat "value observers" and "result observers" separately: Two classes ...
Martin R's user avatar
  • 23.5k
2 votes

Observer pattern for temperature and pressure sensors

The way how you use pointers is quite dangerous and C++ has tools to make this totally safe. The biggest problem of your implementation is the usage of possibly dangling pointers in your subject ...
Maikel's user avatar
  • 740

Only top scored, non community-wiki answers of a minimum length are eligible