假设我正在开发一个相对较大的项目。我已经用Doxygen记录了我的所有类和函数,但是,我有个主意,在每个源代码文件上都写上“程序员笔记”。
这背后的想法是用通俗的术语解释一个特定的类是如何工作的(不仅是为什么大多数评论如此)。换句话说,让其他程序员对类的工作方式有另一种看法。
例如:
/*
* PROGRAMMER'S NOTES:
*
* As stated in the documentation, the GamepadManager class
* reads joystick joystick input using SDL and 'parses' SDL events to
* Qt signals.
*
* Most of the code here is about goofing around the joystick mappings.
* We want to avoid having different joystick behaviours between
* operating systems to have a more integrated user experience, since
* we don't want team members to have a bad surprise while
* driving their robots with different laptops.
*
* Unfortunately, we cannot use SDL's GamepadAPI because the robots
* are interested in getting the button/axes numbers, not the "A" or
* "X" button.
*
* To get around this issue, we created a INI file for the most common
* controllers that maps each joystick button/axis to the "standard"
* buttons and axes used by most teams.
*
* We choose to use INI files because we can safely use QSettings
* to read its values and we don't have to worry about having to use
* third-party tools to read other formats.
*/
这是使大型项目更容易让新的程序员/贡献者理解其工作方式的好方法吗?除了保持一致的编码风格和“标准”目录组织外,针对这些情况是否还有“标准”或建议?