在C#中有多少行之前的类应考虑进行重构? [英] In C# how many lines before a class should be consider to be refactored?

查看:133
本文介绍了在C#中有多少行之前的类应考虑进行重构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个很好的经验法则是,我智能化重构任何方式超过50行。

A good rule of thumb by is that I intelligently refactor any method over 50 lines.

该计数不包括注释和空白,但实际的代码。我之所以还要说聪明的是,有很多次,其中一类超过50行是可以接受的,不能或不应该被改变。

The count does not include comments and white space but actual code. The reason I also say intelligently is there are plenty of times where a class over 50 lines is acceptable and cannot or should not be changed.

我没有一个规则拇指类。一般来说,我不检查类,看看他们是否应该进行重构。

I do not have a rule of thumb for classes. Generally I don't check classes to see if they should be refactored.

在我目前的项目我只是完成一个类,几乎是4000线长。但是没有方法50,​​而大部分的线路和方法都是私人,而不是作用于类之外的任何数据。

On my currently project I have just about complete a class that is almost 4000 lines long. However no methods over 50, and most of the lines and methods are private and not acting on any data outside of the class.

什么是根据经验,重构类规则?

What is the rule of thumb for refactoring classes?

推荐答案

在该类违反的 SRP ,它的时间来重构。

When the class violates the SRP, it's time to refactor.

这篇关于在C#中有多少行之前的类应考虑进行重构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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