finmath / finmath-lib

Mathematical Finance Library: Algorithms and methodologies related to mathematical finance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Observer Pattern and lazy recalculation

AlessandroGnoatto opened this issue · comments

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.

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).

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.

I also added the class LazyObject in the meantime.

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.