NiMARE icon indicating copy to clipboard operation
NiMARE copied to clipboard

RF Suggestion: Instance methods vs helper functions

Open adelavega opened this issue 2 years ago • 1 comments

Here's a potential suggestion (/discussion/note to self) regarding the complex abstractions in NiMARE:

I noticed there are many cases where at a level of abstraction there are instance methods that take self as an argument but don't use it. In other words, they are pure static methods that make sense for all children to inherit and hence are put at the level of abstraction.

One example (although I'm sure there are better ones): https://github.com/neurostuff/NiMARE/blob/83d9f5575e8c90031fd27734fdea1278ae3861c0/nimare/base.py#L77

One idea would be to remove these from classes and make them pure helper functions which may make it easy to know which methods are called by who and when.

This would be more akin to how nilearn/sklearn avoid excessive abstractions

adelavega avatar Apr 22 '22 22:04 adelavega

Are there any other cases that anyone can think of where we can move methods to functions?

tsalo avatar May 31 '22 15:05 tsalo