Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am currently in a similar situation, where I have implemented bits-and-pieces of functionality (file I/O through some API, main parts of the work, etc.). So maybe some of my experiences would be helpful:</p> <ul> <li>If you have some code already, it may help to draw a diagram of what you have. Pen-and-paper, or even better UML can help here (btw, a good UML tool which can import existing classes is Umbrello). Sometimes I do this kind of "design check" after the last commit, and it helped me to spot some subtle problems, especially in the design stages, where I was refactoring classes daily;</li> <li>If you have written code for the components, I think you can easily formulate some requirements for each one, and from these you can create some tests (e.g. with 'UnitCPPLite'). Currently, I have the test in the main file, with some boilerplate code which triggers the test execution before anything else is done in the application (although this is still not optimal);</li> <li>Finally, I would add to the recommendation of ComtriS the idea of "include guards" (if you don't use them already), to prevent multiple inclusion of the header files. So, in practice, I typically end-up with something like this:</li> </ul> <p>src/CFoo.h:</p> <pre><code>// class 'CFoo': header file #ifndef CFOO_H #define CFOO_H #include &lt;only_what_you_need_in_declaration_interface&gt; class CFoo { private: // class data public: // constructors, destructors, getters, setters, etc. void doWork(); }; #endif /* CFOO_H */ </code></pre> <p>src/CFoo.cpp:</p> <pre><code>// class 'CFoo': implementation file #include "CFoo.h" #include &lt;what_you_need_in_addition_for_internal_workings_of_methods&gt; // code for other methods... void CFoo::doWork() { // work } </code></pre> <p>Hope it helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload