Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are comment headers and footers in your code really necessary? [closed]

Tags:

Many corporate coding standards require a large comment header and footer in each and every file. Something like:

// MyFile.cpp // //  Copyright (c) 200x Company ABC //  //  This file is a copyrighted... blah blah blah //  <... some code ...>  // Copyright (c) 200x Company ABC // //  Change history: //     1.0  -  Blah //     1.1  -  Blah, blah.. 

So, the question is - why do we need this? Is this really necessary to claim copyright for the contents of the file, or is it a misguided practice that has become standard? Anybody out there work for a company that does NOT require something like this?

like image 651
Joe Schneider Avatar asked Apr 05 '09 11:04

Joe Schneider


People also ask

How much does it cost to comment code?

A good goal is to have 1 comment for every 1-4 lines of code. Be sure to not only document what your code is doing, but, as you begin writing more advanced code, you should document what was intentionally left out, optimized away, tried and discarded, etc - basically, any design decision you make.

Where is header and footer in WordPress?

Go to WordPress Dashboard > Templates > ThemeBuilder. Click Add New Template and choose Header (or Footer) Name your header template and click Create Header (or Footer) Now you'll be able to either choose a premade header (or footer) template or create one from scratch.

Where is the header code in WordPress?

Adding Code to Header and Footer in WordPress Once the plugin is activated, go to Code Snippets » Header & Footer from your WordPress admin panel. After that, you will see a 'Header' box where you can add your code. If you scroll down, you'll also see a 'Body' and a 'Footer' box.


2 Answers

First, the change history is pointless, use your SCM for that.

A copyright statement is not strictly required (copyright is automatic)1, but if you are publishing source then likely including it will be felt to be safer2. The full licence statement would probably be better in a separate file and then referenced (this is what Boost does).

1Wikipedia has a reasonable summary, but you really need to take your own legal advice.

2 Especially by lawyers playing it safe.

like image 59
Richard Avatar answered Sep 22 '22 04:09

Richard


My company doesn't require this... and the place of the change history should be in the source code control instead of the code file.

like image 36
Nicolas Dorier Avatar answered Sep 20 '22 04:09

Nicolas Dorier