我们的应用程序中有很多功能可以非常具体地描述为一个模块。通常有某种设置对话框,然后当用户单击确定时,它会配置一个进程来运行并运行该进程。有时他们更投入,用户会打开新对话框并在对话框上工作一段时间,做许多对底层数据库进行更改的事情。
我通常会得到几个标准课程
ConfigPanel.cs
ConfigPanelData.cs
ProcessRunner.cs
ApiWrapper.cs (for calling the process from somewhere else)
如果我有更多端到端模块,它可能是 WorkerPanel.cs WorkerData.cs SetupOptions.cs(面板状态在运行之间保持)Lib/WhateverBackendStuffINeedToSupportModule ApiWrapper
现在每个都有文件夹:
UI/Panels/
Module1Panel.cs
Module2Panel.cs
UI/PanelData/
Module1PanelData.cs
Module2PanelData.cs
UI/PanelManagers
Module1PanelManager.cs
Module2PanelManager.cs
Core/Module1/
Module1.cs
Module1Helpers.cs
Core/Module2/
Module2.cs
Module2Helpers.cs
如您所见,一切都真正展开了。对于 50 多个模块,这些文件夹并没有真正组织起来。即使按子系统将它们分解,它们仍然是一团糟。将所有内容放在一起以便所有内容都按功能而不是类类型分隔会是糟糕的设计吗?
Module1/
Module1Panel.cs
Module1PanelData.cs
Module1PanelManager.cs
Module1PanelLib.cs
Module1PanelWrapper.cs
Module2/
Module2Panel.cs
Module2PanelData.cs
Module2PanelManager.cs
Module2PanelLib.cs
Module2PanelWrapper.cs
你如何组织你的课程,有什么优点/缺点?