What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

Possible Duplicate:
Attribution etiquette in code — do you cite helpful question URLS in code?

If someone answers a question with some code, what's the etiquette for including it (and its technique) in closed source software?

Do you add a comment with a link to the SO question or do you just take the advice and implement the code without any attribution?

Boaz Yaniv really helped me out of a jam with this answer:
Python: override __str__ in an exception instance

...and I want to make sure that my team doesn't think I'm the smart one based on Boaz's inspiration.

Any advice?

share|improve this question

migrated from stackoverflow.com May 9 '11 at 17:22

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Uphill Luge, Jeff Atwood May 11 '11 at 6:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
This should be on meta. –  hammar May 9 '11 at 17:22
4  
Man, this is like the first law of coding: only include attribution when the code breaks. :) –  MusiGenesis May 9 '11 at 17:22
    
This is what comments in your source code are for. Every language worth writing in supports them. –  Cody Gray May 10 '11 at 8:47

1 Answer 1

up vote 10 down vote accepted

It's partly etiquette, and partly good programming, but I'd definitely add the comment with a link to the SO question. Not only is it polite, but it will add context to the code on the off chance that your documentation doesn't answer all questions.

See also this question which addresses the legality: Using code posted on StackOverflow

share|improve this answer
1  
I can't provide any examples but I know for a fact that I've seen someone include an SO comment in their code on a publicly available project –  Daniel DiPaolo May 9 '11 at 17:27
3  
@Daniel DiPaolo: Google Code Search has zillions of examples of that. –  Greg Hewgill May 9 '11 at 22:43

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