heudiconv icon indicating copy to clipboard operation
heudiconv copied to clipboard

Should heuristics be refactored as classes?

Open iglpdc opened this issue 8 years ago • 2 comments

The current version of the code takes one of the files under heuristics as an argument. The file has an implementation of the function infotodict that parses seqinfo in some particular way.

This implies some code repetition (e.g. the create_key function is repeated in most of the files) and it's hard to test.

I think it could be a good idea to implement the functionality in these files as classes. New heuristics could be derived from a base class defining just create_key and infotodict. The main script would get an argument with the name of the class as a string and create the proper class using some factory for heuristics.

iglpdc avatar Mar 05 '17 20:03 iglpdc

@iglpdc - any help would be much appreciated. right now there is a big discussion going on about testing and merging #32 to maintain a common code base. i would like to see a few pieces of refactoring post that merge but it would be good to focus energy on the merge to prevent divergence.

satra avatar Mar 12 '17 14:03 satra

Since then we got some basic testing going on, even for some individual heuristics. Indeed though refactoring as classes could help to centralize/harmonize their interfaces. So I would say issue remains relevant.

yarikoptic avatar Jan 25 '23 18:01 yarikoptic