n 层应用程序中的方法级文档

发布于 2024-07-18 17:48:26 字数 974 浏览 4 评论 0原文

我的情况:

我的应用程序的数据请求链如下所示:

(Client) -> (WebService) -> (SQL or OLAP Cube)

客户端是一个 Silverlight 应用程序,它使用生成的代理与 WCF Web 服务进行通信。 反过来,它使用 DAL 组件进行授权并访问 SQL DB 和 OLAP 多维数据集,基本上它只是转发请求。 因此,每种方法存在于四个不同的地方:

// WCF Webservice interface and implementation (used by client)
public interface ICatalogService 
public class CatalogService : ICatalogService

// DAL interface and implementation (used by webservice)
public interface ICatalogDataAccessLayer
public class CatalogDataAccessLayer : ICatalogDataAccessLayer    

现在我的问题是,我应该在哪里放置文档来清楚地指定这些方法? 在类或接口级别、在 DAL 或 Web 服务上?

到目前为止我的想法:

我想说在接口上编写方法规范是最有意义的,因为它是正在使用的合约。 然而,在我的具体情况下,我没有看到 webservice 和 DAL 之间的优势:

  • 我是唯一的开发人员,没有单独的 webservice-guy 或 client-guy 需要文档
  • 这是一个封闭的架构,webservice 不是公开
  • 的将来从事这个项目时,将可以访问它的所有组件(并且可以找到文档,无论它们在哪里)

那么,您对此有何看法? 在这种情况下,我应该将方法级文档放在哪里?

My Situation:

The data request chain of my application looks like this:

(Client) -> (WebService) -> (SQL or OLAP Cube)

The client is a Silverlight Application that uses a generated proxy to communicate with a WCF webservice. Which in turn does authorization and accesses SQL DB's and OLAP Cubes using a DAL component, basically it just forwards the requests. Therefore, each method exists in four different places:

// WCF Webservice interface and implementation (used by client)
public interface ICatalogService 
public class CatalogService : ICatalogService

// DAL interface and implementation (used by webservice)
public interface ICatalogDataAccessLayer
public class CatalogDataAccessLayer : ICatalogDataAccessLayer    

Now my question, where should I put documentation to clearly specify these methods? On class or interface level, on the DAL or on the webservice?

My thoughts so far:

I would say it makes most sense to write the method specs on the interface, because it is the contract that is being consumed. However I don't see an advantage between webservice and DAL in my specific situation:

  • I am the only developer, there is no separate webservice-guy or client-guy that needs the docs
  • This is a closed architecture, the webservice is not public
  • Everyone working on this project in the future, will have access to all components of it (and will find the docs, wherever they are)

So, what do you think about it? Where should I put method-level documentation in this case?

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

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

发布评论

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

评论(1

偷得浮生 2024-07-25 17:48:26

我认为大多数人会期望 Web 服务比 DAL 拥有更多的文档(特别是如果 DAL 主要是生成的代码:我猜是这样,因为这些是传递方法)。 我会在 DAL 注释中添加指向 Web 服务文档的指针,供将来使用它的人员使用。

原因是双重的。 首先,Web 服务是真正的交互点(因此可以添加更多客户端,这意味着记录服务是一个优点)。 第二个是,DAL 听起来确实不像它通过 Web 服务(在所描述的配置中)提供“附加值”,因此回到交互和价值的真实点是有意义的。

如果 DAL 曾经受到另一个客户端重用而没有 Web 服务层的威胁……显然,这会改变事情以相反的方式倾斜(或自动执行重复的注释)。

I would think that most people would expect a web service to be documented more heavily than a DAL (especially if the DAL is mostly generated code: I'm guessing so as these are pass-through methods). I would add a pointer to the web service documentation in the DAL comments for those who work with it in the future.

The reason is twofold. First, the Web Service is the real point of interaction (and thus the point where more clients might be added, which means having the service documented is a plus). The second is that the DAL really doesn't sound like it provides "added value" over the Web Service (in the configuration described), so pointing back to the real point of interaction and value makes sense.

If the DAL was ever threatened with reuse by another client without the web service layer... obviously that changes things to lean the other way around (or to automate duplicate comments).

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