注释接口,实现还是两者? [英] Comment the interface, implementation or both?

查看:131
本文介绍了注释接口,实现还是两者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,我们所有(当我们可以打扰!)评论我们的界面。例如

I imagine that we all (when we can be bothered!) comment our interfaces. e.g.

/// <summary>
/// Foo Interface
/// </summary>
public interface Foo
{
    /// <summary>
    /// Will 'bar'
    /// </summary>
    /// <param name="wibble">Wibble factor</param>
    void Bar(string wibble);
}

您还评论了实现(可能还会提供给客户,例如作为aa图书馆的一部分)?如果是这样,你如何管理保持两个同步?

Do you also comment the implementation (which may also be provided to clients, e.g. as part of a a library)? If so how do you manage keeping the two in sync? Or do you just add a 'See interface for documentation' comment?

感谢

推荐答案

作为一般规则,我使用与代码相同的DRY(不要重复自己)原则:

As a general rule, I use the same DRY (Don't Repeat Yourself) principle as with code:



Java

有关详细信息:

  • Official javadoc documentation
  • Some unofficial advice.

这篇关于注释接口,实现还是两者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆