什么时候上课太久? [英] When is a class too long?

查看:86
本文介绍了什么时候上课太久?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么时候函数太长?是该问题的子集,我想.

When is a function too long? is a subset of this question, I think.

确定班级时间过长的几个好的指标是什么?

我正在为与外部承包商的项目修订一组代码接受准则,并意识到我过去没有涉及到这一点,但将来应该涉及到这一点.

I'm rerevising a set of code acceptance guidelines for a project with external contractors, and realized I haven't covered this in the past, but should cover this in the future.

推荐答案

具有多个职责时.

让我引用罗伯特·C·马丁(Robert C. Martin)的干净代码在这里:

Let me quote Robert C. Martin's Clean Code here:

类的第一个规则是它们应该很小.第二 类的规则是它们应该小于该值. ... 和 我们通过计数物理线来测量尺寸的功能.上课时 使用不同的方法.我们计算责任. [第10章,第136页]

The first rule of classes is that they should be small. The second rule of classes is that they should be smaller than that. ... With functions we measured size by counting physical lines. With classes we use a different measure. We count responsibilities. [Chapter 10, page 136]

这篇关于什么时候上课太久?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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