Copy/pasting is one of the most obvious code smells. I don't do it, you should never do it, and anyone who does should rightly be considered at best irresponsible and at worst incompetent.
The first reason is obvious - you need to understand every line of code you check in. I won't beat a dead horse here.
There is a more subtle point, however. Every programmer writes in their own style and it's important that your code has a consistent style (yours). This doesn't just include the cosmetic aspects (e.g. indentation), but also design tendencies, word choice, etc. I've never seen a piece of code someone else has written and thought "Wow, that's exactly how I would've done it." If you're willing to tolerate a completely different style in your source, then I question the degree to which you care about your craft, and consequently all of your work the way I would an author's if I found 5 pages written by someone else in their book.
So, please, read the code, understand why it works, figure out how you would do it, then code that up.
Comments
"Copy/paste code from answer."
Copy/pasting is one of the most obvious code smells. I don't do it, you should never do it, and anyone who does should rightly be considered at best irresponsible and at worst incompetent.
The first reason is obvious - you need to understand every line of code you check in. I won't beat a dead horse here.
There is a more subtle point, however. Every programmer writes in their own style and it's important that your code has a consistent style (yours). This doesn't just include the cosmetic aspects (e.g. indentation), but also design tendencies, word choice, etc. I've never seen a piece of code someone else has written and thought "Wow, that's exactly how I would've done it." If you're willing to tolerate a completely different style in your source, then I question the degree to which you care about your craft, and consequently all of your work the way I would an author's if I found 5 pages written by someone else in their book.
So, please, read the code, understand why it works, figure out how you would do it, then code that up.