mercredi 23 janvier 2019

Abstract Factory Desing pattern implementation in Python

I am rewriting my already working Python code in a OOP manner as I want to implement it in a modular way. I have a dataset that has been obtained using several parameters. I want to implement an Abstract Factory Pattern and with that instantiate different objects containing different datasets with different parameters. The ultimate goal is that with two different datasets I can calculate specific stuff and I don't know how to implement a method that applies to both concrete objects.

enter image description here

In the image that I'm sharing it can be seen both the abstract factory method and two concrete datasets called FompyDatasetHigh and FompyDatasetLow (I know the UML is not right but its only to show the structure). Then I want to implement a method called Dibl that applies to both datasets and returns a calculation. The implementation of the Abstract Factory method I understand, is at the method where I get lost.

So how would you write a method that applies to both Concrete Factory Objects

I hope the information I've given its enough if not I can try to provide something else.

Thanks!

Aucun commentaire:

Enregistrer un commentaire