A question for everyone: see subject. Let me explain. We have all sort
of concepts implemented in SGObject

very basic stuff such as
-get_name
-ref counter

a bit higher level
-register parameters, put/get/add

even a bit higher and depending on the previous
-close/equals/serialize(soon)

even higher
-observable

and then a bunch of junk, such as the get_global stuff ...

Viktor and I had a discussing on how to trim this down a bit. The
question is how.

I was wondering what your thoughts are on making those functionalities
mixins, which we can then use to build a more elaborate hierarchy of
base classes, and more importantly use those concepts in other places
without having to take the whole SGObject. An additional benefit would
be a smaller SGObject.h, which is getting quite big these days.

Example Observable. Not every shogun class will be observable, mostly
only CMachine subclasses are actually, why would e.g. CFeatures be?
Yet all that Rxcpp stuff is in the base class, lists of registered
observed and more. Even worse, observables need "iteration number"
but the concept of iterative algorithms is only implemented in
CIterativeMachine mixin, so we have to do ugly things. Another point
here is that the ObservedValue really strongly benefits from being
able to retreive parameters using .get, yet all the other
functionality of SGObject just spamming the memory without being used.
A mixin might solve both concepts while avoiding to add things we dont
need.

In fact for all of the above concepts, wouldnt it be nicer if we could
add them to a class if we needed them, rather than by default? Then
the actualy base class could be much slimmer, or in fact we could have
multiple to group certain features (e.g. many classes such as CMachine
needs to be observable, serializable, clonable, etc)

Let me know your thoughts

Reply via email to