It's a common practice to place copyright notices, various legal disclaimers and sometimes even full license agreements in each source file of an open-source project. Is this really necessary for a (1) open-source project and (2) closed-source project? What are you trying to achieve or prevent by putting these notices in source files?

I understand it's a legal question and I doubt we can get a fully competent answer here at programmers.SO (it's for programmers, isn't it?) What would also be interesting to hear is, when you put legal stuff in your source files, is it because "everyone does it" or you got legal advice? What was the reasoning?


  Is this really necessary


No. It's not legally required. (I am not a lawyer, but I've seen this stated by one.)


If you've got a project where individual files might be taken out of context, it may be sensible - but it only requires a couple of lines, to say something like:


  This file is part of <project> which is released under <license>.
  See file <filename> or go to <url> for full license details.



For anything else, you can simply put a LICENSE text file in the project root, and any relevant details/credits/etc in the README file - it's still copyrighted (automatically), so it's just a question of being clear license-wise in the readme file.
