I usually leave my email address as a courtesy in case someone wants to ask me a question about it later. Do other people leave more or less information than that? Does anyone leave a phone number??
I almost never leave my name nor e-mail address :
- It tends to get copy-pasted (yeah, bad practice) ; and I end up with people contacting me for code I didn't write
- When the code is modified, the contact info is not removed nor update ; and I end up with people contacting me about code that has changed so much I don't even recognize it.
Instead, I prefer pointing people to the code repository (SVN, Git, ...) : there, they can have the full history -- and find out who wrote / modified the portion they have a question about.
I use to be in the habit of leaving my name or initials in comment headers, with a revision number and a brief description of the change.
I've recently gotten out of that habit given the fact the this is redundant with version control, e.g. any one interested in who made what changes can see the entire history of the source code in version control.
If you are developing software professionally, you are most probably using some version control system (svn, hg, git, etc). In this case, I find it redundant to leave your personal information inside the code since you already have a coder account (with that information) to be able to commit code on the project.
However, some people from the open source community find it interesting to leave a name and email address for contact. This is not a bad idea at all. Check this examples:
/* * Interplay C93 video decoder * Copyright (c) 2007 Anssi Hannula <email@example.com> * * This file is part of FFmpeg. */
/* (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) (c) Copyright 2000-2004 Convergence (integrated media) GmbH All rights reserved. Written by Denis Oliver Kropp <firstname.lastname@example.org>, Andreas Hundt <email@example.com>, Sven Neumann <firstname.lastname@example.org>, Ville Syrjälä <email@example.com> and Claudio Ciccani <firstname.lastname@example.org>. */
But surely leaving my name and or email would mean i was supposed to write comments in my code?? Sorry was not an answer. In reality i usually leave doctype comments ...
/** * @author PurplePilot * @package * @etc */
with my name but not email address. Yes this code can get cut and pasted but if the copier does not change the author name they won't change anything else and it becomes obvious it is an unmaintained comment.
I have an email sig i use from time to time which goes
/* Anything you put in comments is not tested and easily goes out of date. */
which seems to be a general reflection of many of the other posts in this thread. However as there are not rules on the subject a programmer needs to do what they feel the most comfortable with.
I often leave my initials in comments (where appropriate), but I don't see any reason to leave anything more. If the I'm still working at the company that owns the code, people should know how to get in touch with me.
If I've left the company and work elsewhere, it's not really fair on my new employer if I'm taking calls about software at my last company (who could be a competitor!).
If the code was shared in some other way (eg. open-source, posted online), then it's possibly worthwhile having your contact details, but if the code was passed on another way, the person you gave it to will likely already have your contact details, and would you really want a random stranger calling asking about code you wrote years earlier?
There's a line of thought that says: Don't put in your source code stuff that should be in the source control.
Authorship information is one of these things, since over time, code will be modified by many people at less than file granularity. A blame log should tell you everything you need to know.
That being said, many companies follow the transition of listing the original file author and never changing it. Whether it's really useful (as people leave companies), I don't know.
I suspect that the main value is building awareness. You will not go and ask the IDE to tell you who authored each file that you see, but by encountering these over time in your group's codebase, you get an idea of responsibilities and expertise in the project.
For public domain - the benefit is "advertising", the downside is that someone could wreck your file in the future but it would still be bearing your name.
I never leave my contact details in the code. It always get out of date and seems to cause more problems then it solves.
Other people have pointed out quite a few of the problems, but I wanted to mention one that I think is the most insidious effects.
It can destroy team work and code quality.
How may you ask, well it all has to do with collective code ownership. If you put your name of the code, then the next person coming in will say "that isn't my code, I will just X" where X can be hack it, ignore it, etc. Then if they do fix it, they of course want to put their name on the code because they improved it. But then you may think, hey I spent weeks on this code and they spent 10 minutes why do they get to have their name right by mine. Over time this cycle continues and people argue about who should get credit (or blame) for the code.
It just doesn't work out well for the team. Instead if the team focused on collective ownership and making all the code great with no ownership you can focus on what is really important which is the quality of the system. If you do need to track down who has worked on it you can always use the VCS to get the details.
Note: Even copyright headers can have this destructive impact if it has the name of a developer, especially if the developer is not as active as other contributors. That is why on Open Source projects I try to only mention authors in an AUTHORS or contributors file one place in the project.
I don't tend to leave my contact information in source code as my VCS takes care of accountability for me.
That said, it's advisable to have your contact information somewhere so that people who use the code can contact you directly to provide feedback. A link to a project website in the README file is generally good practice.
The convention comes from the era when Usenet and IRC were used regularly to share source code. Since the code was rarely linked from a VCS and more often sent directly, if you wanted feedback you would have to include your contact information somewhere.