finmath / finmath-lib

Mathematical Finance Library: Algorithms and methodologies related to mathematical finance.
Apache License 2.0
488 stars 168 forks source link

Observer Pattern and lazy recalculation #39

Closed AlessandroGnoatto closed 4 years ago

AlessandroGnoatto commented 7 years ago

The library should provide a mechanism for the interaction between market data (Observables) and products (Observers). You can find a tentative implementation of the Observer pattern at the following link: https://github.com/AlessandroGnoatto/mafinlib

This implementation is thread safe with an exception.

The next Feature would then be lazy recalculation happening only to the products which are notified.

oliverdauben commented 7 years ago

Just a quick remark regarding naming conventions. I'd suggest renaming ConcreteObservable to something like ObservableImpl (or using IObservable for the Interface and Observable for the implementation).

AlessandroGnoatto commented 7 years ago

Hi, thanks for the comment. I renamed Observer to ObserverInterface, Observable to ObservableInterface and ConcreteObservable to Observable. I believe that putting Interface as a suffix is more in line with the style of finmath: we have e.g. BrownianMotionInterface and so on.

AlessandroGnoatto commented 7 years ago

I also added the class LazyObject in the meantime.

AlessandroGnoatto commented 5 years ago

Hi, this is also quite an old discussion. The design I was proposing was mainly quantlib inspired. In the meantime I have come to the conclusion that that design is a very cumbersome one. It would be interesting to see instead if we can couple finmath with RxJava 2.