确定将代码分解到不同文件夹和命名空间的最佳方法

发布于 2024-07-10 06:43:20 字数 133 浏览 5 评论 0原文

我有以下目录:

-UI
-业务逻辑
-数据访问
-BusinessObjects

如果我有一个类是服务器端服务的客户端存根,它会更改服务器系统上的状态,那么它会去哪里。 。

i have the following directories:

-UI
-BusinessLogic
-DataAccess
-BusinessObjects

if i have a class that is a client stub to a server side service that changes state on a server system, where would that go . .

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

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

发布评论

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

评论(4

最美不过初阳 2024-07-17 06:43:20

这段代码属于回收站;-)

严重的是,如果你编写了它并且不知道它去了哪里,那么要么代码有问题,要么你的分区有问题; 我们如何才能比您拥有更多有关您系统的信息?

现在,如果您只是想要一些不知情的意见,我们已经得到了 PB 级的意见:

  1. 它出现在 UI 中,因为您说它是客户端存根,
  2. 它出现在业务逻辑中,因为它实现了业务规则的效果,
  3. 它出现在数据中访问层,因为它正在访问状态更改的服务,因此
  4. 它进入业务对象层,因为它会导致服务器上的状态更改,

如果您告诉我们存根实际上做了什么,将会更有帮助; 没有具体细节,很难知道它属于哪里,和/或很容易在真空中争论它“应该”属于哪里

this code belongs in the recycle bin ;-)

seriously, if you wrote it and don't know where it goes, then either the code is questionable or your partitioning is questionable; how are we supposed to have more information about your system than you have?

now if you just want some uninformed opinions, those we've got by the petabyte:

  1. it goes in the UI because you said it's a client stub
  2. it goes in the business logic because it implements the effect of a business rule
  3. it goes in the data access layer because it is accessing a state-changing service
  4. it goes in the business object layer because it results in a state change on the server

it would be more helpful if you told us what the stub actually does; without specifics it is hard to know where it belongs, and/or it is easy to argue in a vacuum about where it "should" belong

笨笨の傻瓜 2024-07-17 06:43:20

我认为这是一种数据访问形式,尽管我不清楚您是否需要将其与其他数据访问类放在同一个项目中。 请记住,这些层主要是概念性的——帮助您保持设计简洁。 将它们分成不同的项目有助于组织,但不是强制性的。 如果它是一个实际的存根类,那么数据访问项目可能是它的自然归宿,但如果它仅在 UI 层中使用,那么将其保留在那里可能就可以了。

I would consider this a form of data access, although it's not clear to me that you need to put it in the same project as the rest of your data access classes. Remember that the layers are mainly conceptual -- to help you keep your design clean. Separating them into different projects helps organizationally, but is not mandatory. If it's an actual stub class, then the data access project is probably the natural home for it, but if it's only used in the UI layer, then keeping it there would probably be ok.

黎夕旧梦 2024-07-17 06:43:20

我认为它不属于其中任何一个。 您要么需要一个新目录,要么需要一个全新的项目。 但在给出的这些中,我不得不说 BusinessObjects,因为它肯定不会根据您的描述访问数据,而只是像本地对象(存根)一样工作。

I don't think it belongs in any of those. You either need a new directory or a new project entirely. But out of those given, I would have to say BusinessObjects because it's certainly not accessing data according to your description, and rather is simply acting like a local object (stub).

优雅的叶子 2024-07-17 06:43:20

在 Web 服务存储库中。

In a web service repository.

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