这个班是否根据“中间人”代码气味计数? 我有一个“人”类。我还有一个班级人员列表,其中有一个Person_list列表,并且具有添加,删除和用Person类别做其他事情的方法。 我从另一个类访问Person_list类。 这是否计数在中间人或任何其他代码的气味? class P{
}
public class PL {
Vector<P> p;
String name;
你经常会看到这样一些代码多余else分支: public void bla()
{
if (conditionTrue)
{
// long code here
} else {
// otherwise do nothing
return;
}
// some more code
}
else分支显然是下滑向
假设你有这样的代码: public Base
{
abstract void Register();
}
public Registrator1: Base
{
override void Register()
{
//uses the current state of the object to populate the UI captions
在对this other SO post中的答案发表评论时,发现使用Thread.Sleep()方法是一种代码异味。 我很难相信没有使用这种方法并不表示你做错了什么。我可以想象一下我的头顶上有一对夫妇: 以编程方式关闭其他应用程序;除非你想杀死应用程序(有时甚至是这样),你需要等待几秒钟才能正常终止。 .NET 2.0代码:是的,它仍然存在。 Thread.Yield()直到.NET 4才被发明,