java方法应具有的标准参数数量是多少? [英] what is the standard number of parameters that a java method should have?

查看:198
本文介绍了java方法应具有的标准参数数量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,用于检查方法的参数数量并打印出警告消息(它是一个代码计划程序)如果标准不止于此,问题是我不知道是什么约定的数字是。我环顾四周,没有运气。谁能告诉我或至少指出我正确的方向?

I am writing a program that checks the number of parameters of a methods and prints out a warning message (its a codesmell program) If there are more than what the standard is, the problem is that I don't know what the agreed number is. I have looked around and not had any luck. Can anyone tell me or at least point me in the right direction?

推荐答案

您可以在Java中指定的参数数量没有标准限制,但根据代码完成 看到这篇文章)你应该将参数数量限制在7左右,这将对你的代码的可读性产生负面影响。

There is no standard limit on the number of parameters you can specify in Java, but according to "Code Complete" (see this post) you should limit the amount of parameters to about 7, any more and it will have a negative effect on the readability of your code.

这篇关于java方法应具有的标准参数数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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