Class with too many parameters: better design strategy?

后端 未结 13 973
醉酒成梦
醉酒成梦 2020-12-04 08:29

I am working with models of neurons. One class I am designing is a cell class which is a topological description of a neuron (several compartments connected together). It ha

13条回答
  •  孤街浪徒
    2020-12-04 09:00

    Having so many parameters suggests that the class is probably doing too many things.

    I suggest that you want to divide your class into several classes, each of which take some of your parameters. That way each class is simpler and won't take so many parameters.

    Without knowing more about your code, I can't say exactly how you should split it up.

提交回复
热议问题