This course has already ended.

Exercise: Documentation of Interfaces

In the previous exercise you got fraction.hh/.cc, string.hh/.cc, vector.hh/.cc classes that were the documentation is missing.

Design by Contract

Produce for the given classes Fraction, String ja VectorInt and the given operations of them:

  • precondition (interface documentation + test)
  • postcondition (interface documentation + test)
  • class invariant (documentation + test, this is for classes, not for operations)

Write the documentation in the comments of source files in Doxygen format. QtCreator generates a template automatically, when you start a comment as /*! and press carriage return.

Add documentation for one class and one function, code to check the conditions, generate documentation and then repeat the same for rest of the functions and classes.

For writing the tests for pre and post conditions, add definitions for the functions (You can generate an implementation template for each member function declaration with QtCreator operation right click > Refactor > Add definition in..). Add code to test conditions within each function or write reusable private member function(s) for testing the conditions and the class invariant. Date class implementation uses both together as an example.

You can produce documentation by executing command doxygen in the command line or by executing it in doxywizard program. You can read documentation by opening the page (Open File / Ctrl-o) <task-directory>/html/index.html with a web browser.

It does not matter, if you have not documented all member functions.

What kind of pre- and post conditions were needed? Was finding the suitable level of contracts difficult?

A+ presents the exercise submission form here.

Posting submission...