您在类中允许的最大方法的限制N是多少? [英] What is the limit N of maximum methods you allow in your classes?

查看:135
本文介绍了您在类中允许的最大方法的限制N是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

填写面向对象概念调查(为一些学术研究人员提供有关软件设计的生活数据),我遇到了这个问题:

While filling in The Object Oriented Concepts Survey (To provide some academic researchers with real-life data on software design), I came upon this question:

您的课程中允许的最大方法的限制N是多少?

What is the limit N of maximum methods you allow in your classes?

然后调查继续询问您是否达到该限制N后是否重构班级.

The survey then goes on asking if you refactor your classes once you reach this limit N.

老实说,我在设计应用程序时从未考虑过这样的限制,并且想知道这背后的原因是什么.为什么我要自我强加一个可能非常依赖于类功能的任意数字?

I've honestly never thought about such a limit while designing my applications and wonder what the reasoning behind this is. Why would I want to self-impose myself an arbitrary number which probably is very dependent on the classes functionality?

推荐答案

您不必限制N的最大值.但是您必须遵循高凝聚力"原则.并且不要创建所有可以做的类.

You don't have to limit N of maximum. But you have to follow 'High Cohesion' principe. And don't create all-can-do-whatever-it-is classes.

我想你应该开始担心N了.但这实际上取决于类本身及其主要目标.

I suppose there is some N after which you should start worrying. But it is really depends on the class itself and its primary goal.

这篇关于您在类中允许的最大方法的限制N是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆