I met this situation here: the OP (who's new on SO) was looking for something that I've already done, but it's a (sure small but) real project and I can't put all the sources on the answer (JAVA, XML, properties, etc.).

How should I process then? May I ask his email in a comment?

  • May you...I guess so. But that's not what I would do. If you really want to get in contact, just put some of your information into your profile. I.e. how he can find out where to contact you (via your website or whatever). Then there is no need to explicitly put email addresses into posts or comments. – Bart Mar 22 '13 at 9:11
  • 5
    First, your answer needs improvement... it is just a link. If you can elaborate on why this plugin is useful in this case instead of linking to the goals, it might be better. If the links are inaccessible or the links change, your answer would have limited value. – psubsee2003 Mar 22 '13 at 9:11
  • But I'm with @Bart on this one... you can if you want. But if the source code would solve the OP's question, then why not include a useful snippet in your answer and post the entire source on pastebin or jsfiddle or something, then you could just link to the source that way, – psubsee2003 Mar 22 '13 at 9:15

If you do end up providing actual files to the OP in one manner or another you'll need to remember that the question itself is still going to remain long after they've sorted the problem themselves. The question remains because StackOverflow is a site for repositories of answers, not quick support fixes. It's conceivable that other people will have the same issues in future, search SO / Google for the problem and see this question and your answer. The fact that at one point in history you provided some actual (long deleted) files to the original asker of the question isn't going to be of any help to them though, making the answer worthless.

Really, if the answer requires so many files and examples to be of use then either a) the question itself is far too broad to fit the site so should be updated, or b) the answer should be structured so that just the relevant parts of the code are included thereby benefiting future visitors too.


When the problem is that you have code too big to include in the answer, assuming you're willing to make the code public, the best solution is usually to host it elsewhere and link to it. You can use a pastebin for this (such as pastebin.com, or, as we often use on Ask Ubuntu, paste.ubuntu.com — there are many others, of course).

If one of the reasons the source code should not be included in a post on a Stack Exchange site pertains to its licensing, and the code is in a pastebin, I recommend raising that point explicitly in your answer. (This may help to prevent others from editing some of it into your question, if their edits would be beyond the limits of fair use.) If the code is somewhere like Github, then presumably it's part of a source tree with a copyright statement...

In any case, it's advisable for every source code "file," whether it's a real file or simply a page in a pastebin that may or may not correspond to an actual file, to contain a prominent, visible copyright statement at the top, with licensing information if applicable. That advice doesn't really have anything to do with Stack Exchange--it's just good practice, generally. It's good practice even for source code that is not intended to be released to anyone at all. (Please note that you do not need a copyright notice for your source code to be copyrighted, however. Under U.S. law since the 1970's and international treaties, a work is copyrighted by its author automatically upon creation, and the copyright must be explicitly disclaimed in order not to exist. Oh, and I'm not a lawyer and nothing in this post is legal advice.)

(If the source code is public domain, then of course it should not have a copyright statement, but you can still have a statement indicating that it is public domain.)

  • +1, but also a comment. For unreleased code, copyright notices are usually quite counterproductive. The copyright exists automatically, without any notice, from the day the code was written or edited. Company names and years of creation of the work both evolve much more faster than developers eager to do the right thing realize. The will to continuously update all the notices soon wanes so all they accomplish over the years is distracting other developers. I guess that this answer would be improved if it was strictly focussed on released code only. – Jirka Hanika Mar 22 '13 at 9:55
  • @JirkaHanika I'm not sure I agree about not including copyright notices--there are many circumstances that may arise rapidly where source code may need to be shown to someone. Also, if the code incorporates other code that requires a copyright notice (ideally such code should be in separate files but this is not always practical, and not always done when it is), it's good to include your own to cover the other code in the file, otherwise it looks like you're saying all the code in the file is copyright that other person/entity. You're right the copyright exists automatically, of course. – Eliah Kagan Mar 22 '13 at 9:59
  • Well, I respect your view, maybe I just don't trust myself, a non-lawyer and non-seer, in drafting proclamations that will help and not just confuse things in times of unforeseen and uncontrolled code releases. However, what you said is "It's good practice even for source code that is not intended to be released to anyone at all." and this I see as not only debatable, but also completely off topic to the question. The following parenthesis is arguably off topic for the whole site. Who cares about pre-1970's? And it's inaccurate as stated wrt Buenos Aires Convention anyway. – Jirka Hanika Mar 22 '13 at 13:18
  • @JirkaHanika How is what I have said inaccurate? I've said that copyright exists automatically when a work is created. Are you now saying that it does not? – Eliah Kagan Mar 22 '13 at 13:19
  • The copyright exists automatically. It is enforceable under some copyright-related international treaties and not under others. It's your answer, not mine, I simply recommend you sticking to the valuable, on-topic part of it, and that's published source code only. We don't need to agree on the off topic part, which is unpublished source code. That's all from me. – Jirka Hanika Mar 22 '13 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .