Comment the interface, implementation or both?

后端 未结 9 1280
萌比男神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

    The interface only. Commenting both is duplication and it's likely that the two sets of comments will eventually get out of sync if the code changes. Comment the implementation with "implements MyInterface"... Things like Doxygen will generate docs that include the derived docs into the docs for the implementation anyway (if you set them up correctly).

提交回复
热议问题