Well, this post is really not an design post either. But since you were talking about interfaces, I decided to post my thoughts in here too.
For a newcomer like me, it would be great to see some kind of interface specifications - and I am talking about function interfaces for different systems.
a simplified example:
Let's assume I am programming an engine to display a thermometer. I could have functions like:
Code: Select all
/**
*\brief Function to initialize termometer system for use.
*
* Must be called before termometer-component can be used.
*
* @param
* @returns true if success, false if fails
*
* @see termometer termometerUninitializeEngine()
*/
bool termometerInitializeEngine(void);
/**
*\brief Function to set temperature.
*
* Can be used to set temperature. If temperature which is not between TEMP_MAX and TEMP_MIN is given, call is ignored, and
* warning is being printed in log file.
*
* @param int temperature Numerical value for temperature.
* @returns previous temperature
*
* @see termometer termometerSetWarming()
*/
int termometerSetTemperature(int temperature);
/**
*\brief Function to set temperature to fahrenheit or celsius scale.
*
* Default scale is set to be Celsius.
*
* @param ETermometerScaleType scale can be ETermometerScaleType_Celsius or ETermometerScaleType_Fahrenheit
* @returns true if success, false if fails
*
* @see
*/
int setScaleType(ETermometerScaleType scale);
That would ease newcomers life Besides, if this was done, then almost anyone who's capable to writing code could implement pieces. (After all, you already have requirements. When requirements and interfaces are known, well, rest is just implementation and testing.) Naturally this would also allow more accurate testing...
I know this sounds like hard work, but it really is worth the time used. Naturally the most important things are things which are going to be used outside of 'termometer component'.
If the doxygen syntax is used, then these comments can be in header files, and readable documentation can be produced && displayed in web (as html) && offered for download as pdf.