Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    Instead of copying and pasting code, it's entirely possible to write it in a reusable way. Then use that instead of copying and pasting it. Commented Nov 8, 2016 at 19:52
  • 2
    @BjornTipling Yes, it is usually preferable to break code down into reusable functions unless that process adds complexity and the code will never be reused Commented Nov 17, 2016 at 1:34
  • If you're copying and pasting it, you are reusing it. I agree people should use their heads and that the conditions may warrant it. I have found myself doing copying and pasting when writing tests, but even there I try to create reusable functions, but then there are like two or three lines that are nearly the same, but I can't quite generalize it enough to turn into a reusable function. Commented Nov 17, 2016 at 2:08