如何为 Web 应用程序记录一组复杂的相互依赖的控件?

发布于 2024-12-15 23:28:31 字数 390 浏览 2 评论 0原文

我有一个网络应用程序报告界面,其中包含十几个具有多种相互依赖性的控件,例如:

  • 如果为营销活动选择了多个营销活动或“全部”,则营销活动应该位于“分组依据”过滤器中(
  • 如果它是产品 X 视图)并且已为此客户端分配辅助发布商选项,请添加“包括辅助发布商”复选框。
  • 如果选中“包括辅助发布者”,则将辅助发布者添加到“分组依据”过滤器中。

可能有近一百个这样的规则,并且我的代码已变得相当复杂。在进行大规模重写之前,我想记录依赖关系,以便我们可以进行一些更好的自动化测试。

有关此类文档的最佳实践的任何指示吗?

当我在这里时,有任何管理代码复杂性的指示吗? (我正在考虑使用 knockout.js,因为它似乎或多或少是为这种情况构建的......)

I've got a web app reporting interface with a dozen controls with multiple interdependencies, such as:

  • if more than one campaign or "All" is selected for campaigns then Campaign should be in the Group By filter
  • if it's the Product X view and the Secondary Publisher option has been assigned for this client, add the "Include Secondary Publisher" checkbox.
  • if "Include Secondary Publisher" is checked, then add Secondary Publisher to the Group By filter

There are probably close to a hundred such rules and my code has gotten fairly complex. Before I undertake a big re-write, I want to document the dependencies so we can get some better automated tests in place.

Any pointers toward best practices for such documentation?

While I'm here, any pointers for managing the code complexity? (I'm thinking of using knockout.js, since it seems more or less built for this sort of situation....)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸢与 2024-12-22 23:28:31

也许不是正确的答案,但是:自己去编写这些自动化测试。它们将充当可执行文档。如果你用相同的风格编写它们并保持简短,它们在某种程度上甚至可以是人类可读的。

Maybe not the right answer, but: go and write those automated tests themselves. They will act as executable documentation. If you write them with the same style and keep them short, they can be even human-readable, to some extent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文