5. - 무엇을 알 수 있었을까요?
메서드가 정의하는 리턴 타입, 파라미터
하지만, 클래스가 무엇을 수행하는지는 알기
힘듭니다.
6. /// 하나의 RGB(Red, Green, Blue)색을 표현한다.
/// (0,0,0)은 검은색 그리고 (1,1,1)은 흰색
class RGBColor{
/// 0부터 1사이에 있는 float값을 이용해서 RGB색을 생성
RGBColor(float red, float green, float blue);
~RGBColor();
//색의 빨강색 요소를 리턴한다. 값의 범위는 0부터 1사이다.
float Red() const;
float Green() const;
float Blue() const;
void Set(float, float, float);
}
7. 9.1.2 Documenting the Interface’s Contract
계약 프로그래밍?
소프트웨어 컴포넌트는 자신들이 제공할 서
비스에 대한 계약,의무를 제공하며 이 서비스의
클라이언트는 컴포넌트를 통해 그 계약에 합의
한다는 것?
10. 9.1.2 Documenting the Interface’s Contract
1. 사전조건
클라리언트는 함수를 호출하기 전에
요구된 사전조건들을 만족시켜야한다.
11. 9.1.2 Documenting the Interface’s Contract
2. 사후조건
함수는 동작이 완료되면 특정조건이
만족될 것이라는 점을 보장한다.
12. 9.1.2 Documenting the Interface’s Contract
3. 클래스 불변조건
클래스의 모든 인스턴스가 반드시
만족시켜야 하는 제약조건
13. ///
/// brief Calculate the square root of a floating point number.
/// pre value >= 0
/// post fabs((result * result) value) < 0.001
///
double SquareRoot(double value);
14. 9.1.2 Documenting the Interface’s Contract
상속된 클래스의 사전조건은
그 부모 클래스가 가진것보다 강하지 않고 오
히려 약해 질 수 있다.
-켄 퓨
27. 9.4 DOXYGEN - 주석
/** ///
* ... text … /// … text ...
*/ ///
/*! //!
* ... text … //! … text ...
*/ //!
28. 9.4 DOXYGEN - 파일주석
///
/// file <filename>
///
/// brief <brief description>
///
/// author <list of author names>
/// date <date description>
/// since <API version when added>
///
/// <description of module>
///
/// <license and copyright information>
///
29. 9.4 DOXYGEN - 클래스 주석
///
/// class <class name> [header file] [header name]
///
/// brief <brief description>
///
/// <detailed description>
///
/// author <list of author names>
/// date <date description>
/// since <API version when added>
///
30. 9.4 DOXYGEN - 메서드 주석
///
/// brief <brief description>
///
/// <detailed description>
///
/// param[in] <input parameter name> <description>
/// param[out] <output parameter name> <description>
/// return <description of the return value>
/// since <API version when added>
/// see <methods to list in the see also section>
/// note <optional note about the method>
///