LSSTDESC / rail_base

Base classes for RAIL
MIT License
0 stars 1 forks source link

Specify interfaces for inheritance with abstract base classes #26

Open jlvdb opened 1 year ago

jlvdb commented 1 year ago

Some base classes in RAIL are commonly used implement algorithms or other utilities. In some cases it is not immediately clear which class methods are part of the base implementation and which should be overwritten/implemented by a subclass.

Example

rail.core.DataHandle: The methods _open, _read, _write, _initialize_write, _write_chunk, _finalize_write, _size, _iterator all raise NotImplementedErrors when the subclass does not implement them. ModelHandle for example implements only the first three methods, which may lead to unexpected behaviour. It is not clear which methods are required and in which context exceptions may occur. Furthermore, the methods are not fully documented and it is not always clear which functionality and in/outputs must be covered.

Suggestions

Impact

Simplifies subclassing and clarifies the logical relationship between different classes.

jlvdb commented 1 year ago

I will start by adding the missing doc strings in core.data

jlvdb commented 1 year ago

Next add a subclassing guide to the class docstring