loading...
Play Button Pause Button

The truth about using Stack Overflow || Copy & Paste Developers

realtoughcandy profile image RealToughCandy.io ・1 min read

This video originally appeared on YouTube. Come follow me there!

Copying and pasting the highest-upvoted answer on Stack Overflow is a practice almost all software developers can relate to.

Whether we were short on time, got frustrated or just didn't feel like doing it ourselves, Stack Overflow has provided millions of developers with answers to their coding problems that have saved us incalculable time and preserved our sanity.

But copying & pasting code can get us into trouble as developers. Watch today's video as RealToughCandy shares with you some of the pros and cons of copying and pasting code, Stack Overflow style.

Discussion

pic
Editor guide
Collapse
byrro profile image
Renato Byrro

I'd prefer to read instead of watching.

Haven't watched your video, but based on my past experiences, that 10 minute video could probably fit a two-minute read article. People tend to get more verbose in front of a camera.

And would fit better the DEV publishing platform (instead of only using it to drive people away without delivering anything valuable in return).

Just sharing my personal point of view...

Collapse
adam_cyclones profile image
Adam Crockett

Stack overflow eventually becomes a place to pick the right solution not always the top answer.

As for understanding, did you test it, you don't actually have to understand all of your code at once at any given time. As long as there are tests and the solution is not overengineered.

Collapse
ferricoxide profile image
Thomas H Jones II

Generally, when I end up on Stack, I'm looking for the gist of what I'm trying to accomplish. By the time I've resorted to Googling and getting taken to Stack, I've already got enough of my code in place that I've established the vars, style, etc. that I'm looking to use ...and it's rare that what's in the Stack answer I consult will fit "as is" into the code I already have (at least, not without being a only slightly-less-obvious than commenting the block with "see <STACK_ANSWER_URL>".

Collapse
sibi profile image
sibi

As long as we understand how it works. It's all good :) saves ton of time

Collapse
peledzohar profile image
Zohar Peled

Good code doesn't rot. I have personally written applications that lived on for more than a decade, and at least one of them (that I know of) is still alive and being used today, on a daily basis.

However, that doesn't mean one should use code they can't understand - with that I totally agree - You should understand the code you're using, even if it's copied from online resources.

If a piece of code is not self explanatory, a comment that explains it can save many hours of frustration later on.

To illustrate my last point - one more personal story: A couple of years ago I had to re-implement an algorithm I've written about 8 years before - and the fact that it was heavily commented spared me well over two days of work.

Collapse
eddt profile image
Edd Twilbeck

I have to say that while yes, I'll use SO "answers", I always force myself to pick it apart and understand the fix, insuring it doesn't mess anything else up - that's CRITICAL - you have to LEARN from the fix you found (sort of as you've said regarding the upkeep)!

Collapse
devvyd profile image
Dāvis Naglis

10 min video = 2 minutes of reading. When it comes to video, there is more chit-chat which is just a waste of time for those who truly want to hear the details.

Collapse
thomasjunkos profile image
Thomas Junkツ

The ultimate usage of Stackoverfow as a resource is stacksort.

Collapse
tszecsy profile image
Tamás Szécsy

Copy+Pasting code might get the company you are working for into legal (and financial) trouble if you are just blindly copying the code, without knowin what it is and where it comes from. Companies developing programs, let it be for the enterprise or for automotive industry, have to check and provide evidence that their product is complying with the licence conditions of the libraries and source code they are using. And this includes open source code too, where the freedom to use it free of charge might be due fulfilling several conditions, These conditions might be as simply as just mentioning in the release documentation of the product, that a given code was provided by ACME Ltd. , but in certain cases might be more challangeing like publish your product's own source code, which companies would like to avoid, since it would mean giving away their hughe intellectual know-how for free.

Collapse
ben profile image
Ben Halpern

Coffee talk 😄

Collapse
micmor profile image
Michael Morawietz

Sorry, what are you talking about?