Ada 95 Quality and Style Guide Chapter 3

Chapter 3: Readability - TOC - 3.3 COMMENTS

3.3.2 File Headers

guideline

  • Put a file header on each source file.
  • Place ownership, responsibility, and history information for the file in the file header.
  • instantiation

    - Put a copyright notice in the file header.
    - Put the author's name and department in the file header.
    - Put a revision history in the file header, including a summary of each change, the date, and the name of the person making the change.

    example

    ------------------------------------------------------------------------
    --      Copyright (c) 1991, Software Productivity Consortium, Inc.
    --      All rights reserved.
    -- Author: J. Smith
    -- Department:System Software Department
    -- Revision History:
    --   7/9/91 J. Smith
    --     - Added function Size_Of to support queries of node sizes.
    --     - Fixed bug in Set_Size which caused overlap of large nodes.
    --   7/1/91 M. Jones
    --     - Optimized clipping algorithm for speed.
    --   6/25/91 J. Smith
    --     - Original version.
    ------------------------------------------------------------------------
    

    rationale

    Ownership information should be present in each file if you want to be sure to protect your rights to the software. Furthermore, for high visibility, it should be the first thing in the file.

    Responsibility and revision history information should be present in each file for the sake of future maintainers; this is the header information most trusted by maintainers because it accumulates. It does not evolve. There is no need to ever go back and modify the author's name or the revision history of a file. As the code evolves, the revision history should be updated to reflect each change. At worst, it will be incomplete; it should rarely be wrong. Also, the number and frequency of changes and the number of different people who made the changes over the history of a unit can be good indicators of the integrity of the implementation with respect to the design.

    Information about how to find the original author should be included in the file header, in addition to the author's name, to make it easier for maintainers to find the author in case questions arise. However, detailed information like phone numbers, mail stops, office numbers, and computer account user names are too volatile to be very useful. It is better to record the department for which the author was working when the code was written. This information is still useful if the author moves offices, changes departments, or even leaves the company because the department is likely to retain responsibility for the original version of the code.

    notes

    With modern configuration management systems, explicitly capturing version history as header comments may be superfluous. The configuration management tool maintains a more reliable and consistent (from a content point of view) change history. Some systems can re-create earlier versions of a unit.


    < Previous Page Search Contents Index Next Page >
    1 2 3 4 5 6 7 8 9 10 11
    TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC
    Appendix References Bibliography