2016-06-27 26 views
-1

我想在評論中提供設計決策。我希望通過對源代碼的粗略檢查,將設計決策評論與功能合同評論區分開來。Android Studio:區分不同類型的評論

如何去呢?

+0

你能提供這些不同類型的評論的例子嗎?他們會用不同的角色劃定界限嗎? – FishStix

回答

1

如果我理解的問題,那麼這是非常標準的用例的Javadoc:

/** 
* Contractual description of the method. 
* 
* @param bar Describe expectations of parameter bar 
* @return Describe what can be expected of the return 
*/ 
// Some non-contractual comment for the method as a whole. 
public int foo(int bar) { 
    // Some comment for code section a. 
    // a 
    // Some comment for code section b. 
    // b 
    // ... 
} 

的合同說明Javadoc中,這是在評論與包裹塊註釋這就是定義/** */(特別是在開始時兩個星號; Javadoc的簽名)和設計決定/一般在正常評論(//,或不太常見的/* */)。

+0

如果你可以提供一些參考鏈接,那會很好。謝謝! – q126y

+0

[Wikipedia](https://en.wikipedia.org/wiki/Javadoc)是一個非常全面的參考。還有[Oracle教程](http://www.oracle.com/technetwork/java/javase/documentation/index-137483.html)。 – Ironcache