3. Headers
One very popular use for comments is to add a header at the very start of the code. This header can describe the program as a whole.
Good information to have in a header includes:
- The original author of the code. This way if the reader has any questions about the program, they know who to go to for answers.
- The date that the program was written. This gives the reader some idea of where to start with optimising the code. Features and tools that were developed after the program was written will probably not be used, after all.
- The version number of the program. Useful programs are often updated multiple times, with each new "version" making different changes. By comparing the version number in the header to a documented "version history" of the program, the reader can be sure which version of the program they are looking at and which bugs and features have already been amended.
This is a typical header block for a subroutine
/********************* /* Function Purpose: To apply shading to a passed wireframe /* Author: Lena Tompkins /* Created: 23-Sept-2023 /* Version: 2.34 pixel_shader_type = 'OpenGL' // This uses the OpenGL standard
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: What should be in a code header?