Comment the interface, implementation or both?

后端 未结 9 1291
萌比男神i
萌比男神i 2020-12-13 03:08

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

/// 
/// Foo Interface
/// 
public interface Fo         


        
9条回答
  •  余生分开走
    2020-12-13 03:53

    Commenting the interface should be enough documentation to figure out how to use the actual implementation. The only time that I would add comments to the implementation is if it has private functions that were inserted to satisfy the interface, however they would be internal only comments and would not be seen in documentation online or available to clients.

    Implementations are just that, as long as they conform to the interface there is no need to document them separately.

提交回复
热议问题