teach-ict.com logo

THE education site for computer science and ICT

Maintainable code

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.