Skip to docs navigation

00.06 Citing Code


Always cite your code when you did not write it. Use code comments to describe where the code came from and how you used and modified it. Paste a url of the code source in the code comments

Knowledge Transfer

In any type of knowledge use and creation we learn from, use, and reference the work of others. Without the ability to transfer knowledge from person to person and across generations, everyone would need to learn and discover everything from scratch. Human beings have the invaluable technology of cultural transfer. We all stand on the shoulders of those who have come before and future folk will stand on our collective shoulders. Solely on ethical grounds, it is important to give credit to those who you learn from.

It is also a matter of academic integrity and sometimes a legal obligation.

When should I cite a source in my code?

When you copy code from an external source. Whether you are copying a snippet of code or an entire module, you should credit the source.

When you copy the code and adapt it, you should still credit the source. You were not the original developer of the code.

How should I cite the code?

Generally, the URL and the date of retrieval are sufficient. Add more details if it will help the reader get a clearer understanding of the source.

If you adapted the code, you should indicate “Adapted from:” or “Based on” so it is understood that you modified the code.

Your instructor may have specific instructions on how you should or should not cite your sources. If you are not clear on what is acceptable, ask your > instructor.

MIT Academic Integrity Handbook - Writing Code 1

Other Code Citing Resourses