1

I'm a computer science student striving to uphold the principles of Buddhism, particularly the precept of "not taking which is not given." In my journey to learn coding, there are moments when I struggle to write code independently, leading me to seek help from platforms like Stack Overflow or Google. However, I often find myself copying and pasting code from these sources to solve my problems. While this helps me progress in my learning, I'm concerned about whether this practice aligns with ethical standards, especially considering the precept mentioned earlier.

My question is: Does using code from online sources in this manner constitute a violation of ethical principles, particularly the concept of "not taking which is not given"? I understand the importance of integrity in academic and professional settings, but I'm also eager to learn and progress in my coding skills. How can I navigate this ethical dilemma while ensuring that I uphold virtuous principles in my coding practices? Any insights or guidance on this matter would be greatly appreciated.

4
  • 2
    Wouldn't an answer on Stack Overflow qualify as 'something given'?
    – Cdn_Dev
    Commented May 9 at 17:31
  • To make the question clearer, can you explain how it's possible that "code from online sources" might not be "something given"?
    – ChrisW
    Commented May 9 at 18:30
  • One way to ensure that there's no issues is to understand the type of licence that the code being copied is associated with, if any. Perhaps, you can provide more info on this area.
    – Desmon
    Commented May 10 at 8:14
  • Code from Stack Overflow and GitHub is usually open source. You need to educate yourself on software licensing and be aware of specific licenses for code you found online. Licenses define the permissions granted to you and the conditions for their use.
    – ruben2020
    Commented May 10 at 12:16

2 Answers 2

2

There's a pretty long description here of what "taking what is not given" means.

It's mentioned in the suttas as a lay precept, but also spelled out in detail in the monks' Vinaya -- which is why I suggest you read it, i.e. to clarify the details in your mind.

Here's a summary:

  1. Object: anything belonging to another human being or a group of human beings.
  2. Perception: One perceives the object as belonging to another human being or a group of human beings.
  3. Intention: One decides to steal it.
  4. Effort: One takes it.

Part of the question in this case might be, whether what you are taking has been "given".

Perception

For the act of taking what is not given to count as theft, one must also perceive the object as not given. Thus there is no offense if one takes an object, even if it is not given, if one sincerely believes that it is ownerless or thrown away. Similarly, if a bhikkhu takes an object mistaking it for his own or as belonging to a friend who has given him permission to take his things on trust, there is no offense even if the assumption about the trust proves to be a misperception. Also, a bhikkhu who takes things from the Community’s common stores, on the assumption that he has the right to help himself, commits no offense even if the assumption proves false.

Towards the end of the section are thoughts about about "Infringement of copyright" and "Copying computer software". I might say that I've seen monks on this site disagree about copyright -- this says that copyright infringement isn't theft (but may be a different offense) because the owner isn't deprived of it.


In summary my own opinion is that using Stack Overflow is not "taking what is not given" -- because the content there is "given". Everyone who posts on Stack Overflow presumably does so with the intention of "giving" their answer so that it may be used by others.

The Content Permissions section of the Terms of Service say that users post there under a CC BY-SA 4.0 license -- i.e. they give permission for their work to be shared and adapted.

Generally it's normal for a professional programmer to sometimes seek, find, and use some information on Stack Overflow.


However, if you're a student there may be other consideration:

  • "What does (or would) the teacher think of your conduct?"
  • "Am I learning what I should?"

Because:

  • You should generally avoid "plagiarism" in academia.
  • If you copy code fragments but without understanding them, that's probably not the point of the exercise

I suggest you read this meta-topic:

It's written by Stack Overflow users, some of whom are teachers. Although I guess that you're not "asking homework questions" and are instead finding answers already posted -- even so some of this meta-topic might be informative to you as a student. It's not Buddhist (therefore not directly relevant in an answer on this site), but may give you insight into the intention of Stack Overflow users, their motives for "giving" (if you want to "take it in the spirit in which it's intended").

6
  • "Am I learning what I should?" for that matter, I strongly advised not to rely on ChatGPT either. Unless the topic of learning is how to use ChatGPT. 😅
    – Desmon
    Commented May 13 at 5:51
  • 1
    That reminds me of a line in Confucius where he says, "It is for this reason I mistrust plausible men".
    – ChrisW
    Commented May 13 at 5:57
  • ChatGPT is plausible!? Noooo.... 😱
    – Desmon
    Commented May 13 at 6:10
  • AI-assisted programming sounds plausible: we use other tools already (compilers) though I rarely even used "CASE" tools. I'm told recently they're used in mechanical engineering (e.g. to make sense of signals, "what vibration is a bad one?"), in medicine too (e.g. to help radiologists in reviewing images). That "assistance" might be called a "centaur" (i.e. a human at the head) -- again, plausible as a kind of "force multiplier", making each radiologist mote effective. But pluralistic.net/2024/04/29/what-part-of-no/#dont-you-understand warns there's a dark side to "human in the loop".
    – ChrisW
    Commented May 13 at 6:34
  • 1
    That seems to be a premise of much of what he writes. Antidotes to a free market's "race to the bottom" are said to be regulation (e.g. by governments), and competition (e.g. consumers buying elsewhere). Perhaps another is ethics. My employer is obliged to care about software quality -- verification testing, requirements management, version control, trained workers -- and, though there's some management pressure to complete tasks on time, and it's a management prerogative to decide what bugs need fixing when, I never feel pressure to rubber-stamp a peer code review against my judgement!
    – ChrisW
    Commented May 13 at 7:53
1

The reason you're feeling discomfort here is because you are stealing from your own future. When you don't understand code and copy it you are robbing yourself of the opportunity to learn. By robbing your future self of confidence in coding you are creating a delusion of competence. Although you may get a job and fool some people in the beginning, you will eventually be discovered as someone who has copied without understanding. You are stealing from your future self something that you should work for on your own. Coding is very difficult. Although some are gifted, the rest of us have to work very hard to make progress. Please trust yourself to work hard and thoroughly without tricks. It will get easier. You can do this without cheating. It may not be fast, but you will get there!

MN96:10.5: A brahmin who scorns his own wealth, living on alms, fails in his duty like a guard who steals.

1
  • 1
    +1 because you are stealing from your own future, this is spot on! With ChatGPT, it gets worse as it can solve the entire question for you. At least with copy and paste of code, you still need to think, analyze and make the various pieces work together.
    – Desmon
    Commented May 14 at 13:01

You must log in to answer this question.

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