Ribasim icon indicating copy to clipboard operation
Ribasim copied to clipboard

Consider removing RibaMod driver and refactoring RibaMetaMod

Open Huite opened this issue 1 year ago • 2 comments

Currently RibaMod uses a very simple sequential scheme, and RibaMetaMod uses a different scheme as well as incorporating MetaSWAP of course. The latter one can be run without MetaSWAP via booleans.

I think it's worth considering keeping RibaMod and RibaMetaMod as separate classes although with the same scheme, encapsulating the coupling logic in separate (mixin) classes, and assembling the classes via inheritance. This would match the preprocessing, internal:

class RibaMetaCoupling(DriverCoupling):
     ...

class MetaModCoupling(DriverCoupling):
     ...

class RibaModCoupling(DriverCoupling):
    ...

And user facing:

class RibaMod(RibaModCoupling):
     ...

class RibaMetaMod(RibaMetaCoupling, RibaModCoupling, MetaModCoupling):
     ...

This may not be practical, and brings the downsides of multiple inheritance. But generally, using types to skip conditionals is nice.

Huite avatar Jun 13 '24 09:06 Huite

I assume a typo ?

class RibaMod(RibaMetaCoupling): >> class RibaMeta(RibaMetaCoupling):

gijsber avatar Jun 13 '24 09:06 gijsber

Bad copy-pasting on my part yes, I've fixed it now.

Huite avatar Jun 13 '24 09:06 Huite