1

I sometimes put a link to the site where I copied a chunk of code from in case I forget what it does. Is this a bad practice? Should I copy the explanation from the site instead of linking to it?

2 Answers2

0

I think it depends. if it is obvious what the code does a link is probably not needed. I like to add a link to an article with a brief description of the content, if it is not obvious what is going on or if you deviate from the normal way of doing something or you have a special edge case. Don't forget that internet pages don't stay around forever, that's why I never leave only a link.

Also you should consider if the case warrants that you expand your project documentation.

-3

Is this a bad practice?

Yes.

Should I copy the explanation from the site instead of linking to it?

No.

The correct answer is to document the chunk of code in your own words. This means, instead of simply copying, understand it in order to document it.

vin
  • 384