Using other people's code

Last updated by Jeff Ondich, 10 September 2025.

Learning to program in any new context is a zig-zag affair. You need to read and play with sample code, read technical documentation, build new projects on top of starter templates, talk to other people both more and less experienced than you, etc. Often, you need to struggle on your own to fully internalize a concept or technique; other times, you just need somebody to show you.

Sometimes when you are solving a computer programming problem, you find help in the form of somebody else's code. But what code is acceptable to use in your CS class assignments and personal projects, and what responsibilities do you accept by using it?

This document will provide a partial answer for an academic context, but the questions are also important for professional programmers.

Academic integrity at Carleton

Carleton has a policy on academic integrity. This policy applies to all your academic work at Carleton, so you should familiarize yourself with it. Really, read it right now—it's only 490 words.

Licenses

Many modern code reference websites use some variant of the Creative Commons licenses, which are designed to be enforceable in as many countries' legal systems as possible. For example, the license known as Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) currently covers the code that people post in discussions on Stack Overflow.

Suppose you choose to adapt, build upon, or copy some code that is covered by one of the "Attribution-ShareAlike" licenses. If you distribute your resulting code (e.g. hand it in as a class assignment, post it online, sell it to a customer, or email it to a friend), you take on responsibilities delineated in the license. See each specific license for complete details, but for most of the Creative Commons licenses, your main responsibilities are:

There's lots more to it, but that's the gist. Check out the Creative Commons website for a wealth of additional information.

(Note that this stuff can get very complicated. For example, what happens if you adapt chunks of code from more than one author under more than one license? Distributing your adaptation then involves you in multi-licensing issues. Here are some relevant discussions.)

There are many other software licenses in common use, each of which grants some rights and imposes some responsibilities. For example, there's the MIT License, the Apache License, the GNU Free Documentation License, and the GNU Public License. As a general rule, it's important to pay attention to what license covers any code you plan to copy or adapt within your own software.

Additional issues in CS class

When you're writing software for a college class and you want to use or adapt somebody else's code, there are some additional things to consider. For example:

Rough guidelines

The final word on what's acceptable in class comes from your professor and the college's policies. But here are some guidelines for your behavior that are likely to serve you well as minimum requirements no matter what class you're in.

What about LLMs?

As with Stack Overflow, you should not be using more than a small handful of lines of code generated by LLM-based code-generating assistants like Copilot, Claude Code, Cursor, Codex, ChatGPT, Gemini, etc.

Early evidence from ChatGPT suggested that it was capable of remarkable feats of code generation that were also wrong a substantial amount of the time. There was also a study released in late 2022 suggesting that code assistants at that time wrote a lot of insecure code even when it was functionally correct. More recently, there is some evidence that AI coding assistants slow expert programmers down, even though there's plenty of anecdotal evidence of AI-assisted coding can make you more productive. Of course, there's also the concern that sometimes an LLM might delete all your data.

As of summer 2025, it seems clear that LLM-based code assistants require expert guidance and cautious use. To become an expert, you need to practice writing your own code in addition to reading and understanding code that other people (or LLM agents) wrote.

So, it makes sense to experiment with AI coding tools on low-stakes projects. But don't forget that you're trying to learn how software functions, in addition to learning how to build it. So keep your eyes open, and don't lose sight of the "you need to understand your code" item earlier in this document.

One last note. "Citing" LLM output is difficult, since LLM output is probabilistic in nature, and the versions and behavior of any given LLM are changing from month to month. But if you include LLM-generated output in a project, it's a good idea to include an LLM-specific documentation file explaining what portions of your product are LLM-derived, along with the verbatim prompts you used to generate the relevant code.

Happy programming!