reproman icon indicating copy to clipboard operation
reproman copied to clipboard

OPT: separate out specification from implementation modules

Open yarikoptic opened this issue 5 years ago • 1 comments

One of the reasons for slow initial import here and in datalad is that all those modules defining subclasses of Interface also provide implementation for them. Implementation is often implemented as _methods or auxiliary _functions. I think it might benefit from going C/C++ way of having the modules specifying interface (e.g. run.py) to not carry any implementation, be accompanied by the implementation module (e.g. run_impl.py) which would get imported in Run.__call__ and execution would be delegated to e.g. run_impl.__call__ or alike.

That would also make it easier to find an Interface specification, since their definition files would be relatively concise.

What do you think?

yarikoptic avatar Mar 21 '19 18:03 yarikoptic

[I haven't looked at the interface code (in this project or DataLad) in a while, so the picture in my head is a bit fuzzy.]

The general idea sounds reasonable to me.

modules specifying interface (e.g. run.py) to not carry any implementation, be accompanied by the implementation module (e.g. run_impl.py)

Just a matter of taste, but I'd rather have the plain name (e.g., run.py) include the actual implementation and have, say, run_interface.py contain the interface. Or even put multiple interfaces in a single module, since there's not much meat there.

kyleam avatar Mar 21 '19 19:03 kyleam