What's your opinion on inspiration, copying code and the morality of it all?

What's your opinion on inspiration, copying code and the morality of it all?
0

#1

Recently I posted a question about the Tic Tac Toe project and in it I mentioned finding a specific blog that managed to get, what I consider, the best possible answer.

Now, throughout all my time in FCC and software development studies in general I’ve made an effort to not copy code for classes, unless it’s an answer I consider I would’ve thought of myself, a tool I don’t understand or really study the reasoning behind everything that the poster did, as my main goal in those cases is to learn.

Now I find myself in a situation where, I mostly understand what the author intended and why he did everything he did, but there’s currently no way I would’ve reached that same conclusion how I am now, I tried working a solution myself but it simply doesn’t feel right, how inefficient it is and how many specific cases I’m inputting makes me feel uncomfortable, yet I don’t like the idea of simply copying someone else’s code just to finish the last exercise needed for my certificate.

So I wanted to know, what’s your opinion on the topic? Is it even allowed for me to do this? If I already studied the code and reasoning, is it ok for me to transcribe or adapt it and I’m worrying over nothing? I know Googling and looking for help when working on programming is normal, but it’s never felt right to outright copy something, even if I change a few things to make it look different.


I have a confession...sometimes when I'm stuck, I'll copy the solution
#2

I’m quite sure every programmer found himself/herself in this position. And honestly, I don’t think banging your head against the wall for several days would be more beneficial, then checking out someone else’s answer and using it, assuming you understand why this particular solution works. This is basically how you learn.

Look at it this way - it’s not like you came up with the idea that 2*2=4. Somebody told you that. Yet you use this knowledge every day (probably?) to get new information and to learn new things. Nothing wrong with that.


#3

If you already got a solution (messy or not), I wouldn’t copy the code. I think the ability to reproduce the code is a good measure when to copy and when not. (And if you can reproduce it, there is no need for copying).

I don’t see a problem in copying small parts or parts that are only meant to make your project better. But copying the logic for this project seems wrong to me, since the logic is the biggest part of the project.

So, I would recommend you use your own solution, even if that gives some bugs. This way, it is really your project and not an implementation of someone else`s code. I think you might actually learn more by fixing your (messy) code.

But I agree with @KamilCybulski that you shouldn’t keep hanging on this for too long. If you can do it with your own code, absolutely do so. Else, try to find a solution that you do understand and try to see if you can reproduce that.


#4

But I don’t use 22=4 specifically every day, someone taught me how to multiply and that allows me to get the result for 22 same way I get it for 1010 and 78, however if you asked me to write some other kind of AI, say, connect 4, I’m not quite sure I’d be able to follow this same train of thought again, I know that with some practice I’d be able to assimilate that as my own and that AI isn’t the main focus of this certificate (heck, it being a front end certificate I’d assume hardcore programming and algorithms are on the backend projects), but as of now it’s similar to understanding a teacher’s example but not the homework exercises.

Still, knowing I’m not the only one in this situation is comforting.


#5

What exactly do you mean by reproduce?

The problem with this is that the author used a very modular and efficient way of solving the problem by creating an actual AI, I on the other hand am currently hard coding every possibility with a bunch of if statements that make my heart crumble every time I add a new one.

And even then, how much of this logic is mine? Even the decisions I’m programming I’m taking from a blog about Tic Tac Toe (the game).

I honestly don’t know why it’s bothering me so much now, since I’ve looked at other people’s code for inspiration before and, if I manage to understand how they reached that conclusion, I have no problem adapting or trying to work based on that for my own solution, if I can’t understand what they intend to do then I usually just skip it.


#6

I’m in your linked tic tac toe post, and I feel that part of this your frustration could also be a bit my fault :sweat: if it’s a bit true I can tell you that if I go back to the project probably I would rewrite it entirely. I was in the same your situation many times, last one during my Data Viz certificate with some D3.js challenges… It’s normal, sometimes you can copy or better adapt another code after you have understand it, all we need a lot of pratic and exercise to improve our problem solving.

It’s just a matter of time! Don’t worry :smiley:


#7

Software development is engineering, not art. If you find a good solution to a problem, you should use it. As long as you understand why something works, and you are not just copying and pasting, then that is legitimate.

But - if you want to present a project as your own work and as a demonstration of your learning, it needs to be original. You can get inspiration and ideas from other people’s code, and you can copy simple functions, but the overall structure should be your own.


#8

Another perfect example, your warnings idea is something I’m considering to use because, well, it’s good, better than a bunch of ifs, that’s for sure.


#9

What’s the line between inspiration and copying?

Specifically talking about the Tic Tac Toe project, my problem is the minimax solution used by the author, it’s great, I can probably code something similar to it, now that I’ve read and studied it (with a bit of peeking here and there) but with some personal changes, maybe having it be less modular as it’s not something I’m used to do, and having some of the instructions on separated functions instead of just there, but even then, can I still call that mine?


#11

If you want it to be an original project, then you should study minimax until you really know it, then demonstrate your understanding by applying it to a new problem.

I’ve been a teacher a long time, and I’m quite used to reading essays where the student has read exactly one resource and then regurgitated the content in their own essay. This kind of work is not satisfying to read or write. The best students read more and really absorb and digest the knowledge and combine it with everything else they know. Then, when they come to write, they have a freedom of expression and confidence which makes their work original.

With coding, I think it is helpful to be able to code without looking stuff up every two minutes (syntax checks apart). You have to get a certain confidence with the language before you start building with it. Do you really need minimax for this project? The tic tac toe AI is not that hard. Why not come up with your own solution?


#12

Once I’m not surrounded by delicious Christmas food I’ll try and take a deeper look at minimax, since game development and AI are topics I’m interested in I guess I’ll run into it later down the road, so I don’t expect to master the topic right now or anything like that, hopefully after a few projects I’ll have a better grasp of it and won’t need to peek.