scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Process parameter in e.g. CommandService::run is difficult to comprehend

Open frauzufall opened this issue 7 years ago • 2 comments

I want to raise a general issue with the run methods of the CommandService and the Moduleservice (and maybe other places too?).

Future<CommandModule> CommandService::run(String className, boolean process, Object... inputs);

The boolean process parameter for enabling or disabling post- and preprocessing is a bit lost there. It took me a long time to fully understand what pre- and postprocessing really means and I have talked to quite a few developers in this ecosystem who still don't know. If you read code containing some exemplary run call, it is not self-explanatory what this boolean in between the command name and arguments is representing.

Could we not split these two cases into two functions (naming open for discussion)?

Future<CommandModule> CommandService::run(String className, Object... inputs);
Future<CommandModule> CommandService::runNoProcessing(String className, Object... inputs);

They would not interfere with the old version which could be deprecated but still provide backwards compatibility, right?

frauzufall avatar Nov 04 '18 22:11 frauzufall

Hey @frauzufall,

great suggestion! I think ScriptService could profit from the same API improvement 🙂

Cheers, Robert

haesleinhuepf avatar Nov 04 '18 22:11 haesleinhuepf

Just for some context on pre- and post-processing, please also see the open issues #191 and #317.

imagejan avatar Nov 05 '18 09:11 imagejan