这是死代码、冗余代码还是有用代码?

Is this dead code, redundant code or usefull code?

假设您有一个应用程序,其中模块 A 提供服务 SRVA。

您还有根据规范使用 SRVA 的模块 B 和 C。 最后,根据规范,您有模块 D 和 E 不应使用 SRVA。

然后你有2个模式M1和M2。规范规定 SRVA 处理的功能不得在 M1 期间执行。

所以这是我的问题。 你会添加一些代码来防止在 M2 任何地方 执行 SRVA 吗?

我的意思是,如果您在 模块 B 和 C 中包含以下代码:

if(SRVA needed & !M1)
{
  request SRVA
}
else
{
  error
}

模块A中的以下代码:

if(SRVA requested & !M1)
{
  service SRVA
}
else
{
  error
}

你认为这是死代码还是冗余代码? 换句话说,您认为这是一种不好的做法吗?

感谢您的帮助!

So here is my question. Would you add some code preventing the execution of SRVA during M2 everywhere?

,绝对。如果我收到

形式的要求

the functionality handled by SRVA must not be executed during M2.

我会通过编码来纪念它。

但是请修改您编写的伪代码,因为它似乎以相反的方式工作。