gecos-lab / PZero

GNU Affero General Public License v3.0
22 stars 2 forks source link

Static methods? #81

Open andrea-bistacchi opened 1 week ago

andrea-bistacchi commented 1 week ago

Could static methods, and classes mainly based on static methods, be useful in some modules, e.g. for IO functions?

gbene commented 1 week ago

Yes probably. However It depends if there is a need to access the instance or the class itself so I think that at the end it will be a combination of methods, class methods and static methods.

andrea-bistacchi commented 1 week ago

I was thinking about this solution for functions where the output class and the input format are not strictly defined.

For instance you can import polylines with a geological meaning (so instances of PolyLine() that will go into the geological collection) from SHP, GOCAD, and several other formats.

On the other hand, SHP, GOCAD, and several other formats can b used also to import entities that will go in the boundaries, fluids, background collections, etc.

In these cases the IO function cannot be strictly connected to a single class, and this is why at the moment it is implemented as a generic function, not belonging to a class.

Adding these functions to classes that mainly include static functions could improve readability of the code.