Using Online Resources Appropriately
Humans do not stand alone. In programming, as in other arts, we do better work and learn more when we communicate and cooperate. Sometimes, however, people copy the work of others as a way to avoid their own work; such plagiarism is unhelpful and unethical. The other extreme, however, leaves you working without the benefit of other people. Finding the right middle path is one of the things students must learn in their work.
It is normal and acceptable practice to use resources that answer “how do I say” kinds of questions—for example, to look up the parameters for a string method, or how to write a loop using iterators, or some other building block you will use as a part of solving the problem you are working on. If you haven't been exposed to that building block through course resources, cite the resource you got it from in a comment in your code.
On the other hand, looking up exactly how to write an entire program or significant part or chunk of a program is not acceptable in an academic environment. In the CS courses, you are trying to develop problem solving skills, like the ability to break a problem down into simpler pieces, and to work on those pieces in a way that allows you to verify the progress you are making, and to start working on a problem even when you aren't sure of the exact path to the final solution. These abilities are critical as a programmer, but you will never develop them if you start every program by looking for a road map that shows you exactly what to build.
Resources that can be used acceptably
Online programming texts, like Learn C++, that focus on general techniques and building blocks.
Communities where people help each other with coding related problems like Stack Overflow. Be careful to focus on either technical “how do I say ____” questions or conceptual “how does one solve this kind of problem” questions. Do not ask questions like “what code do I write to solve this particular problem”. Look for building blocks, not the final product.
Under no circumstances should you upload your own work to ask for advice on fixing issues in your code. Learning to debug the code you write is every bit as important as learning to write the code in the first place. Advice from a forum will only tell you what you need to fix—not how you could have identified what to fix on your own. The advice in the collaboration guide applies in this case.
If you do find a building block on Stack Overflow, make sure to provide proper citation. The Stack Overflow license requires attribution for code used in projects. Other sites are similar; be sure you know the expectations for attribution and restrictions on copying.
The textbook. There are reasons courses often have textbooks: they consolidate a large amount of information into one convenient place and they present it all in an organized fashion so that as you learn about a topic the examples only make use of other things you already have been exposed to.
Sometimes students spend significant time searching online for information that they could have found more conveniently in the textbook. And then, because the examples they find use lots of ideas that they have not covered, they end up convinced programming is much more complex and mysterious than it really is. So before you start googling a topic, make sure you have checked the text.
Resources that have no acceptable use
Any site that provides completed programs, such as Chegg.
Any forum or discussion board where people (yourself or others) post full programs or solutions.
Another student's code for the problem you are working on. This includes not only students in the same class, but students in other sections and past students.
The use of AI tools like Chat-GPT or Github Copilot to generate code for an assignment. These tools are capable of generating code for basic problems (161 level problems or parts of more complex ones) that is often correct. But they are far from perfect.
Over time, these tools will become commonly used to generate parts of programs. But anyone who aspires to build correct programs with them needs to understand how to verify, fix, and build upon the code that tools can produce as well as how to build their way to a working program. That understanding is not developed by reading code that someone or something has produced for you. Much of the knowledge and skill that you will need to do meaningful development will only come through learning to build programs yourself.
Learning from example work
It is much easier to talk about a problem with a person and get just the minimal hint you need to become unstuck on a problem. Doing the same thing with example work is much harder. How can you use it without having the interactivity to control what you are told?
In classes primarily about how to program, i.e. CS161 and CS162, you should avoid making use of any resources that include complete code that solves your problem or a similar one.
In classes that use programming to explore deeper concepts, i.e. CS260, it may be useful to look at complete examples of code. For example, to explore how Quicksort's partition algorithm works, most samples you find will have code that implements the algorithm; in this case, the point is not to be able to reproduce the same code, but to understand the algorithm that it represents.
Experiment with the solution you found by trying it out. Change or adapt it as you need to, and try it again. Learn what you need to learn from it; asking the questions from Pólya's fourth step (“examine the solution…”) can be useful. Record where you found it, so you can cite it and show other people what influenced your thinking.
Finally, set it aside. Do not look at the example at all while doing your final work. If you have learned from it the right knowledge and skills, you will be able to proceed on your own. If not, go back to all of your sources and learn more, or ask for help from a privileged person such as the teacher.
Accounting for your influences and giving them credit is an important part of academic scholarship. Academics expect to be able to follow trails of citations through the development of an idea or field, learning about their own foundations and history. Admitting that you stand on the shoulders of giants does not make you seem smaller; it adds prestige to the sources you cite and gives other people more confidence in your work.
In the world of software, it is important to keep track of resources that you use and to ensure that the license for reusing them is compatible with how you wish to license your software. For example, if you are using code licensed under the creative commons share alike or the GNU Public License you are required to give credit to the original source and make your work available to others under the same license. The example code distributed with assignments is generally not licensed to allow redistribution at all.
Although it may seem unrelated, starting your assignments as early as possible makes it easier to behave with academic integrity; most of the time, plagiarism is a result of having very little time in which to do something when you realize you are stuck on how to do it. By starting earlier, you leave yourself more time to ask for help, collaborate, and use class resources. Getting repeatedly stuck and unstuck is essential to the process you are practicing. Leave yourself the time to ask for help when you're stuck. Finally, get in the habit of asking for help!