36 ms·
How often do people copy and paste from Stack Overflow?
- math-dev 6y agoAll Day, Everyday. (p.s. SO Blog is really cool - they always post many good and informative articles there).
- metalforever 6y agoThis is an unpopular opinion but I think the answer to this may depend on the age of the engineer. For example, I learned programming before stack overflow. I have most of the standard library syntax in my head and mostly look at spec documents. Once in a great while I will go on stack overflow if I can’t debug a problem but I don’t post on there . In the same way, I suspect some engineers like using video to learn things or debug things but it’s not for me.
- buro9 6y agoThis is probably true. Having lived without the ability to search any random problem and have a snippet of code there, I'm used to searching for academic papers, RFCs, or reference documentation and then build up my understanding and make an implementation that way. There are times that I've not done this though, for example a couple of years ago I was struggling to comprehend how to convert some math from a paper into actual code (the symbols were more than a little odd and I swear a bit of the equation was missing) and yet searching Github revealed a repo where someone had produced snippets of different obscure algorithms. Not quite a cut and paste, but definitely a "read the answer".
- djbeadle 6y agoMy secret move when I'm having trouble setting up a new library or dependency is to search for some common code from it on Github. For example, how do I use the Python requests library (bad example because it has great documentation) would lead me to searching "import requests".
- paxys 6y agoIt's less about age and more about the stack you work with. I know several experienced engineers who have the entire Java library memorized, but have them work on a slightly different stack (or even a newer SDK version) and they will be blindly Googling for answers like anyone else.
- P_I_Staker 6y ago"Kids these days"
- HeyLaughingBoy 6y agoPossibly, but I don't know where the inflection point lies. Before StackOverflow was a "thing," I recall noticing that it was easier to google spec documents on an electronic component even though I had the manufacturer's databook and Application Notes just across the room. The ease of searching the pdf on google outweighed the ease of getting up and paging through the physical book. The main difference was in Application Notes: I could sit down and read some of the better ones like a novel (I'm looking at you, Analog Devices :-) and that was easier with the dead tree copy than the online one.
- mixmastamyk 6y agoSometimes you want a discussion of the pros and cons of the various ways to tackle a problem, in order to find the best approach for your application. This kind of information is almost never in standard documentation.
- ketzo 6y agoYep. There's nothing quite like the experience of going on Stack Overflow for a particular problem, and the "best answer" is almost what you need... but you scroll down, and there's a different version that's exactly what you need! except it's for an older version of the library... but there's a comment on that answer, from two years later, with a quick note on "if you're at version 7+, just do Y instead of X." Absolutely wonderful.
- metalforever 6y agoI use Reddit for this
- lucb1e 6y ago> This is an unpopular opinion [citation needed] These kinds of comments just make those who agree be sure to upvote, they're part of this perceived in-crowd after all, and most of the time (here too) it's fairly obviously true so a lot of people will upvote. Of course a newb will copy more code than a veteran. They also have very different functions in organisations on average. It's neither an opinion nor unpopular.
- metalforever 6y agoThat’s not exactly what I’m saying. Veteran isn’t really the same thing as “age”. Also, I think it is pretty controversial for one to claim that some people don’t really use Stack Overflow
- lucb1e 6y ago> Veteran isn’t really the same thing as “age”. Of course not, but at the same time there are not that many 15-year-old gurus. It's not really the same thing, but on average people will gain more experience as they do a job for longer, and to do a job longer you need to age. It's not causal, but definitely correlated.
- TruthWillHurt 6y ago"We pretty much captured everything except the actual text being copied." Didn't realize I need to browse Stack Overflow in incognito mode...
- podiki 6y ago....I have lots of questions about this "homegrown web tracking tool" (assuming this isn't still part of a joke?). What??? Was this opt-in? Did they track across everyone? What was collected? This is troubling, to say the least.
- somehnguy 6y agoSerious question: why is this troubling? I don't see the big deal, at all. This is absolutely nothing compared to what big advertising & social media do. Taking a count of people who hit ctr+c? Who cares, I can't see any possible scenario of how that data could be used in a bad way unless you think SO is going to email employers with a time spent & ctrl+c count or something?
- cryptoz 6y agoNot OP, but, the troubling parts for me are 1) the tone of the post, and 2) the larger-than-SO issue of the gap in understanding copy+paste for the average user. 1) The post says "unfortunately" they cannot tie logged-out users to their logged-in account. In no moral way is this a reasonable perspective to me. It is extremely fortunate that SO does not build the tech to track you as a logged-in user when you are logged out. That's a bad precedent to set. Sure, some sites do that, but I think they shouldn't. Other examples of the tone in the article abound. It's troubling for sure. 2) It is up to the web devs themselves to decide what goes in your clipboard. Many users don't know this. Sites that exploit the gap between user expectation of privacy while copy+paste as well as tracking do not match with reality. Stack Overflow is merely one of many players here, but they way they exploit this gap is mildly upsetting. Something needs to be done, either technically or communication to users, about copy+paste reality.
- somehnguy 6y agoThanks for the explanation. Honestly I still don't see the big deal though. It's just a little bit of fun with an interesting statistic, not everything needs to be so doom & gloom serious.
- kemiller2002 6y agoHa! Joke's on them. I type it out so it makes it look like I'm doing more work. (But in all seriousness, I normally do type it out, so it forces me to remember what I'm using better.)
- mhb 6y agoThe learning works better if you cut and paste it twice, forget to change something and then discover it after a few hours of debugging.
- p4l4g4 6y agoThis, yes! Not necessarily the copy/paste part, but definitely the debug part! I generally like deeper debug sessions, preferably without too much pressure. Getting deep understanding for a problem and figuring out a solution were the most valuable learning experiences in my career. The satisfaction you get from finding a solution to a hard problem, makes them more memorable. Even if the lessons learned afterward are not spectacular, then at least you got a chance to sharpen the tools in your belt to pin point problems as they occur!
- niix 6y agoSame, I've always done this for anything like this (i.e. tutorials), just to make sure what I'm learning sticks with me a bit more.
- kemiller 6y agoWell, hello, Junior. That's thinking!
- kemiller2002 6y agoHa! Nice username :)
- TameAntelope 6y agoRight? Who is literally copy/pasting, that seems dangerous. I'd describe it as learning the concept/tactic/technique from the SO answer, and if me then implementing that concept/tactic/technique in my own code just so happens to look the same as the provided example, that's fine. Frequently it doesn't, either!
- deleted 6y ago[deleted]
- joinmoin12 6y agoThings started to become more interesting when we asked more detailed questions about who was copying and what they were copying. https://www.geogebra.org/resource/krdc3fxd/Ig5ImkxMQlMX4XvI/material-krdc3fxd.pdf https://www.geogebra.org/resource/krdc3fxd/Ig5ImkxMQlMX4XvI/...
- mattnewton 6y agoI don’t think that link is what you meant to paste?
- aejnsn 6y agoI did work for a small company whose “director of software development” had copied and pasted verbatim basic details from SO enough for it to become a theme. He would copy long, drawn-out, language-level examples from SO rather than use the idiomatic, syntactic sugar provided by the framework and its docs. The duplication would drive me insane.
- johjohjoh 6y agoDon't paste from stackoverflow and do not hire people who paste from stackoverflow or anywhere online. This is literally how software is compromised. I worked with people at another company who had compromised a small part of Google and several banks this way. They contacted the security department later but they were surprised by the number of companies they were able to compromise just by posting instructions online.
- dvirsky 6y agoI would add - unless it's a very short snippet and you understand exactly what it does. My top SO answer is how to convert and IP address from string to integer representation in Python. It's one or two lines, it's perfectly fine to copy that sort of thing. I've actually copied my own code from SO on several occasions.
- ASalazarMX 6y ago> Don't paste from stackoverflow and do not hire people who paste from stackoverflow or anywhere online Crucial corollary: "... that you don't understand". Blindly copy/pasting what you don't understand is the problem. If it's too complex to analyze, it doesn't belong in Stack Overflow.
- cratermoon 6y agoOften enough to inspire this: https://github.com/drathier/stack-overflow-import https://github.com/drathier/stack-overflow-import
- tomrod 6y agoThis seems like a terrible idea!
- deleted 6y ago[deleted]
- flimflamm 6y agoThis seems like a terrific joke!
- tomrod 6y agoIndeed!
- PhillyG 6y agoI'm enjoying the license it uses: "This module is licensed under whatever license you want it to be as long as the license is compatible with the fact that I blatantly copied multiple lines of code from the Python standard library"
- SaltyBackendGuy 6y agoThanks for sharing. This made my afternoon :)
- mixmastamyk 6y agoA terrible, horrible, wonderful idea… (Kind of like one of the Grinch.)
- sethammons 6y agoInspired by stacksort: https://xkcd.com/1185/ https://xkcd.com/1185/
- rriepe 6y agocopy and paste find and replace those are fine, but use a tab not a space CTRL shift L or I'm in hell but please, don't merge my rebase
- chovybizzass 6y agoI look for the clearest, cleanest shortest solution and then I make it better.
- chenster 6y agoPastegrammer
- exhilaration 6y agoOne of the interview questions I ask is, "if you run in a problem you can't solve, where do you go online to find answers?" Anyone that doesn't answer Stack Overflow is - in my opinion - either lying or very, very new to the industry. (This is for .Net/C# jobs so maybe it's different for other languages.)
- MrOxiMoron 6y agoto be honest, I use my search engine of choice, yes stack overflow often comes up in the results, but also GitHub issues of people having a similar issue, often for other projects that use the same tools/libraries I do. so I go to my search engine for answers, not stack overflow directly.
- lostcolony 6y agoYeah. I'd raise an eyebrow at Stack Overflow if they didn't also include Google. Google will get me official API docs, blog posts diving in deep about it, Github issues, as you say, -as well as- anything relevant on Stack Overflow. Maybe they meant to go -ask- questions? Which...I rarely ever do, despite being in this game for over a decade. The few times no one has asked the question I have, it usually has to do with a library or missing functionality, and that tends to get resolved (at least with an answer of "yeah, that isn't supported") via an email.
- bryanrasmussen 6y agoright, often if it is a particular error message Github issues for the library and version you're using is more useful.
- busterarm 6y agoI've been in this industry around 20 years and I can't remember the last time I looked at SO to answer one of my own questions. Other people's, sure, but usually I look at the source code for answers to my questions. The results are more consistent. Now Github Issues on the other hand...
- mgkimsal 6y ago
- busterarm 6y agoI once had a brief contract helping out a two-person Rails consultancy where pretty much all they did was follow RailsCasts. They got very angry at me several times for not doing things "the Rails way". We were on Rails 4, which I already had loads of experience with. The RailsCasts they were following were written for Rails 2. They literally had no idea all of the ways Rails had moved on between those versions. Their codebase was an absolute mess as well. This was an application that was supposed to contain medical records and it had broken routes that were leaking data everywhere unauthenticated. And they were mad that I spent two weeks cleaning all of that up and bulletproofing their application. I was happy to move on from that one, but it taught me a lesson about just how valuable sales skills are. These two people were living a comfortable lifestyle off a single paying client (essentially getting money indirectly through DARPA) and were punching way above their weight technically.
- spaetzleesser 6y agoWith the right connections you can have a very comfortable life with receiving grants from DARPA. I used to work for a startup founded by ex DARPA guys and it quickly showed that there was an insider club of current and former DARPA people that lived off grants.
- neatze 6y agoI was told long time ago that without being "insider" I will never get direct access to NYSE and will be able to make money by doing so, proved them wrong, while there is "insider club" in NYSE, to degree there same "insider club" for DARPA or any other enterprise/organizations. I think interesting questions is; to what degree insider club introduces friction for new comers with justified novel proposals.
- spaetzleesser 6y agoGood for you! Nobody is saying that it’s impossible for an outsider to get access to NYSE or to DARPA. I just said that there are arp ton of insiders who like to hand contracts and grants to each other.
- fredley 6y agoI have spent multiple hours digging into something, found my own Stack Overflow answer and pasted it back in.
- water8 6y agoWhy did you spend hours digging into something you already knew the answer to?
- rolisz 6y agoThey didn't know it any longer. They are using StackOverflow as a second brain, offloading knowledge to it.
- ralusek 6y agoPensieve.
- daveidol 6y agoKnowing something at some point in the past does not mean you currently remember it!
- Kranar 6y agoBecause "knew" is past tense. There are a lot of things that I once "knew" but no longer "know", and it's nice when that past knowledge is documented somewhere.
- zeta0134 6y agoNot OP, but... more often than I care to admit, past me is perfectly aware of the answer to this problem, but present me has long since forgotten.
- ASalazarMX 6y agoSolving a problem once doesn't guarantee it's added to your knowledge. Learning needs repetition, if you solve that problem once a year, you'll learn it very slowly.
- danaris 6y agoPersonally, I try not to copy & paste things I don't understand—unless there's not enough information around the code to explain it, in which case I first copy & paste it, then tweak it and test it enough that I do understand it.
- arduinomancer 6y agoIMO its not even that we're copying people's logic, its just that stack overflow acts as a weird sort of crowd-sourced centralized documentation for programming languages. For example if I forget the name of a function for something in a particular language I don't even go to the docs, I just google something like "python reverse list" and click the first SO link.
- ASalazarMX 6y agoIt's a shame that most manuals have evolved to web pages that you can't download as PDFs or eBooks. Now you usually have to go online to find that keyword, and as you're online already, might as well google for the whole answer. One of the most productive times in my career was programming for the IBM i in the 90s. There were manuals online, but you could also download indexed PDFs versions. IBM did a superb job with their documentation, there was hardly any need to look up anything in the Internet, whatever you needed was in the manuals, examples included. Of course you still used the Internet at work, but mostly for mingling with your peers and having technical discussions, although too many people still blindly copied/pasted from the forums.
- ralusek 6y agoThat's interesting that you say that because I actually have the opposite reaction. When I go to look for documentation and find that it's a PDF, I want to die.
- ASalazarMX 6y agoPDFs are horrible as eBooks, but in a manual I prefer the fidelity of a PDF than the reflowing of an ePUB, or the fickleness, slowness, and potential unavailability of a web page. A well structured and correctly indexed PDF is a godsend, because you just open the table of contents, quickly locate what you're looking for, click and there is your answer. As I said, IBM excels at writing documentation. Every language has a Language Reference manual, and a Programmer's Guide manual. The first is for reference, the second is to learn how to use it, including examples. Don't take my word for it, you can check out, for example, the COBOL manuals here: https://www.ibm.com/docs/en/i/7.1?topic=languages-cobol https://www.ibm.com/docs/en/i/7.1?topic=languages-cobol
- sneak 6y agoI think whatever feature in my browser lets websites determine when I copy text should be ripped out, along with the site's ability to snoop on my scroll position. The sandbox has been broken.
- ev1 6y agoI believe firefox lets you set dom.event.clipboardevents.enabled => false
- nitwit005 6y agoI'd be curious at the length distribution. I tend to copy search terms (LongJavaClassNameThingy) to find some separate documentation. I assume what's going on with the subset of high rep people that do a lot of copying is they're doing searches for duplicate posts.
- cardanome 6y agoI think copy and pasting code is very useful for a junior developer and nothing to be ashamed of. You will learn by debugging and modifying it. As a more senior person, I rarely do copy whole snippets. I will look for general inspiration or to confirm my idea and check if there is a better solution. I wont blatantly copy as it rarely fits into my architecture and code style so it is faster to just directly write it how I need it.
- fctorial 6y agoIt depends on how complicated the codebase is. Junior programmers usually work on simple programs so they can get away by copy pasting snippets.
- nathias 6y agoI have copied the code one time in 2 years, but I ended up heavily modifying and then refactoring anyway ...
- ianmcgowan 6y agoI do it all the time for clever tricks (especially SQL things like tally tables), but like to leave the permalink to the answer that seems best (from the share link below the answers) as a comment in my code. If it's something I had to google for once, it's likely needed in the future and sometimes it's easier to search my own code for all SO links than follow the thread through the labyrinth again...
- shpx 6y agoStack Overflow answers are licensed under a CC BY-SA license.[0] If you copy and paste a function without (at least) linking to the question, isn't that copyright infringement? [0] https://meta.stackexchange.com/questions/333089/ https://meta.stackexchange.com/questions/333089/
- lucb1e 6y agoIt depends. The short of it is that a few lines are often not copyrightable at all, but otherwise you're right. Hence, in my code I actually link to the answer when I think it might meet the bar for copyrightability. One example that comes to mind is a string->number hash function in javascript to assign random but consistent colors to items; I would use the resulting number as hue in CSS.
- o-__-o 6y agoProblem is when “your code” isn’t yours but your employers. Don’t get me wrong this is not a new problem, but you should be aware that simply linking the answer to a comment (esp in a closed source code base) isn’t sufficient
- lucb1e 6y agoOn first glance I think you're wrong, but if you think I am then please tell me more! The stackoverflow license requires attribution and share-alike, so: (1) there is a comment for the attribution, and (2) anyone who sees the code knows they can re-use it because I mention the license for that part of the code. Some licenses also require the binary or derivative works (e.g. rendered webpages) to reproduce a notice to any users, is that a thing with creative commons? I thought CC was for non-code licenses and, as far as I know, the binary showing a notice is not a thing CC specifies. Looking up the summary page[1] on their website, it says I must provide "appropriate attribution" which is a pop-over that specifies it as: > you must provide the name of the creator and attribution parties, a copyright notice, a license notice, a disclaimer notice, and a link to the material I wasn't aware of the required disclaimer notice so it's good that I double-checked, but I do meet the other requirements. Though it's also quite rare that I really copy something as substantial as a whole function, it's not like this is a weekly occurrence. But I'd love to know if I'm doing it wrong, in case you still read this! [1] http://creativecommons.org/licenses/by-sa/4.0/ http://creativecommons.org/licenses/by-sa/4.0/
- LinuxBender 6y agoOn a side note, use caution when doing a copy/paste from a website into a terminal. There are several things you can do to reduce the risk. Here [1] is a demo of one risk vector. The article links back to a discussion here on HN from 2013 on some things you can do to mitigate the risk. [1] - https://thejh.net/misc/website-terminal-copy-paste https://thejh.net/misc/website-terminal-copy-paste
- Dragonai 6y agoThanks for sharing this!
- lucb1e 6y agoIn recent Bash versions this seems to have been fixed (available in Debian Bullseye, currently the 'testing' branch): when you paste something, it'll never auto-execute, even if it contains newlines. It's actually quite annoying as I'll often copy from my terminal itself, purposefully with the trailing newline, and it now refuses to execute. I need to move my hand from mouse to keyboard to hit enter and then (often) back to mouse.
- blibble 6y agothis is called "paste bracketing" if you want to search for it!
- f154hfds 6y agoSo I have copied this answer into probably 100 separate bash scripts over the years: https://stackoverflow.com/a/246128/9084915 https://stackoverflow.com/a/246128/9084915 I've thought about saving it somewhere (sometimes I copy from my other existing scripts) - but it's just too convenient to google/copy directly out of the webpage.
- lucb1e 6y agoThat link goes to: > a useful one-liner which will give you the full directory name of the script So we don't all have to click to find out what this is about...
- spaetzleesser 6y agoI never copy/paste directly but I try to understand what’s going on. It seems there are two kinds of devs: some that just want things get done and others what want to understand. The people who just want get things done will probably be happy copying some code verbatim.
- tabtab 6y agoIf terrorists really wanted to disrupt civilization, then S.O. would be a prime target. I'm just the messenger, shore it up, you've been warned. I'd estimate it solves at least 1/3 of the glitches I encounter from day to day. That being said, I can't stand their all-or-nothing moderating. Let low-rated messages exist, but be hidden by default, similar to Slashdot and Reddit.
- sys_64738 6y agoIt's often faster to google on stack overflow for python code than write it yourself.
- analog31 6y agoI've done it pretty often. Usually I paste the code into a Jupyter notebook (where I do all of my trial and error stuff), modify to suit my need, then add a comment with a link to the original page. I do this with anything that I glean from the Web.
- deleted 6y ago[deleted]
- elpakal 6y agoHow about a GitHub Action which scans lines of code in a PR patch for exact matches on SO? As a reviewer it would be helpful to see 1) was copy pasta 2) what SO comments say about the code (eg has it broken)
- dkersten 6y agoInterestingly, I don't remember when the last time I did so was. I seem to be relying on SO less and less. I do sometimes use it as a quick reference, usually because its one of the first results on search engines, but its typically just a quick "ah, that's the function for that" or "ah, that's how you do X" rather than actually copying code. I'm trying to think what's changed, I guess I've just been writing stuff that either I'm super comfortable with or is niche enough that there's not that much on SO that's helpful. Looking in my browser history, the last thing I looked for that I got an answer on SO is what's the differences between C++'s std::scoped_lock and std::unique_lock, which was a few days ago. I still use SO, just not as frequently as a few years ago.
- Silhouette 6y agoI'm trying to think what's changed Among other possibilities: SO suffers from hostile moderation and a generally unwelcoming culture, perhaps even worse than Wikipedia. This has a profound chilling effect on positive, substantial contributions, particularly from new contributors. SO had a great strategy initially with relying on search engines to index everything, but it never seems to have solved the recency/relevance problem. In that respect, it has become its own worst enemy, with old answers about obsolete versions and practices often ranking highly in search results. The first of those problems then exacerbates the second, because the same cultural issues get in the way of both updating answers to old questions and asking new questions that might be superficially similar to ones that already exist but actually need a different answer. Meanwhile, in many areas of programming, documentation from other sources has become both better in quality and more readily located thanks to other well-known sites and high search engine rankings. Relatively speaking, SO simply isn't as useful if there is already primary documentation that answers questions correctly and comprehensively. And finally, you personally may have grown as a developer over time, becoming both more capable of solving problems for yourself and more familiar with whatever tools you use regularly, so you might not need external help so often. FWIW, I'm also in the "rarely visit SO any more" camp. I think I have a kind of banner blindness for SO hits on search results pages now, perhaps because I'm assuming that following a SO link is unlikely to provide a useful answer so I almost always check other plausible sources first. On those occasions when I do get as far as visiting SO, I'm usually reminded of why I tend to work this way now.
- deleted 6y ago[deleted]
- nynx 6y agoI've found that the amount I use stackoverflow is inversely proportional to the quality of the documentation and the strength of the type-system of the language I'm using.
- lucb1e 6y agoDefinitely. Looking at my browser history for stackoverflow + PHP, it seems to be things to do with PHP, such as how to prevent a referrer from being sent when users click a link on my website. That's of course not actually part of the PHP language, so it would seem like I'm rarely looking up how to use PHP APIs on stackoverflow. I've always found PHP docs to be the best of any language that I've used.
- muglug 6y agoThough even for PHP StackOverflow is still pretty useful e.g: https://www.google.com/search?q=string+contains+word+php https://www.google.com/search?q=string+contains+word+php
- acomjean 6y agoNote that php.net answer (official docs) is right below the stack overflow one. I like the php manual. Its pretty simple and has good exmamples. They seem to used to have allowed/ allowed user comments, which used to be really old. (this one seems more up to date)
- erinan 6y agoThat's me with Python... For some reason I find the documentation extremely cumbersome to navigate and parse. It's just so wordy and dense. And there are barely any examples - which is what I'm usually looking for instead of having to read a whole paragraph. The Elixir documentation on the other hand is succinct and always features basic examples for every function. It's a joy to work with.
- sergiomattei 6y ago
- vmception 6y agoIts one thing when you need to remember how to make a GET request with a certain framework, you can copy and paste that answer, its another thing when you need to integrate the request into your asynchronous queue and store the results in an ORM with JSON serialization, cant copy and paste that
- lucb1e 6y agoI wish they had shared with users how many of their answers/questions/comments were copied from. Views are aplenty but maybe one in a dozen, perhaps one in a hundred of the readers that found it useful actually upvote. I might even link an answer to friends, they express having found it interesting or useful, but no upvote comes in. Not enough karma is often a reason, but also most just don't habitually upvote useful posts and are not usually logged in. I'd love to know how many people make use of my answers, and while there are per-page view counts, of course a view doesn't mean I really helped someone. Number of copies during these two weeks would have been very nice to get as a statistic!
- corobo 6y agoDon't you have to be above a certain score or something to upvote? I remember something about that when I tried once and haven't bothered logging back in since as I didn't have the clout to do anything of value E: I am sorry, you mentioned that but I dived into a reply so fast I missed it. Aye the karma thing they have there really discourages (or at least it did for me) participation. I'm working on the thing that brought me to SO in the first place I'm not spending time building up karma on a dying website to upvote haha.
- lucb1e 6y agoFor what it's worth, if you click it but don't have enough karma, it is recorded and high-rep users can see how often people tried to up/downvote something and compare it to the actual votes. But the screen (I have enough rep to see it) seems to be more of a gimmick than actually used by anyone.
- deleted 6y ago[deleted]
- Waterluvian 6y agoTangent: Does anyone ever intentionally NOT copy and paste, even from their own code? I usually copy/paste, but sometimes I'm inclined to type it out again because it's just... It's just really satisfying. It's like a ballet move or a really graceful hockey play. I find the act of physically typing out some code to be graceful and elegant and just so darn satisfying.
- ineedasername 6y agoI try not to copy & paste if the pasted version needs slight variations. Too often I miss one and waste time debugging. So I try to retype in those situations.
- holoduke 6y agoEvery time when I need to unpack or pack something with tar. Or when I need the email regex validator. Or when I need the 'less' command to scroll to the last line. My memory is weak :)
- ChefboyOG 6y agoIt's weird, nowadays I think the only times I use SO as a reference are when I'm hitting something that is very product-specific (i.e. a weird error message in Typescript that doesn't quite make sense). In those situations, there's usually some SO thread that explains the quirky behavior and workarounds in depth. Otherwise, I'm never there anymore, which certainly wasn't the case years ago.
- virtue3 6y agoAnytime I have a build config issue or something with webpack I've definitely been guilty of just pasting lines and hoping they work. It's still super handy when updating something to a major version and figuring out what broke.
- ziml77 6y agoIt's a great way to get individual functions for odd tasks instead of needing to pull in a whole library. Just last week I needed to implement POPCNT in C# since we're not using .NET 5 so BitOperations.PopCount is unavailable. The naive implementation is easy but this was needed in our core networking code so easy performance wins are good to go look for. A quick Google search brought me to a question on Stack Overflow from someone looking for the exact same thing: a good implementation of POPCNT that works for a single byte[1]. I checked out the answers, found the one that looked the best, pasted it into LINQPad to test all the combinations, and then pasted it into our code with a comment that had the Stack Overflow answer's permalink. I don't see anything wrong with copy-pasting from SO that way. It's quite handy. [1]: Yes, if I'm looking for maximum performance, working with just a byte at a time is not great. But for the data I'm working with, you need to know the population of a byte to find the next byte that needs to be counted.
- intrasight 6y agoI copy and paste into my project diary. Which will also have the question that I'm trying to answer (and perhaps exactly what I googled). And of course the URLs of useful things I found. They are often SO. And then I may copy and paste into my diary. Rarely will I paste into source code. Copy and paste errors I find to undo the benefit vs just typing it in and using my own code style.
- gregmac 6y agoI was working at a company that was acquired a few years ago, and part of the deal was them doing a source-level audit of code, mainly looking at licenses and open-source. They used some software which could detect copy-pasted source code, and had Stack Overflow indexed. The Stack Overflow stuff was a massive, massive pain, for several reasons. For one, it's not clear how CC-BY-SA applies to code[1]. This involved many long meetings with copyright lawyers. They ended up asking for all this to be removed, which our C-level people eventuality agreed to. We had to then go through several hundred "flagged" things (in a hundreds of thousands of lines codebase) and fix or justify everything. Only a few cases were outright copy+paste of a big function or class, and those were at least straightforward: rewrite. Usually it was old code anyway, and replaced with newer style, much more concise code. Tons were one- or two-line things, which involved lots of arguments along the lines of "that is the way to open a file in append mode in this language, and logFile is the appropriate variable name in this case!" This is really a failing of the tool they were using, but it still required answering. The funniest was a handful that were our answers: they were copy+paste our team had done from our code to SO! (Nothing proprietary, just a few lines of an algorithm or solving whatever random problem). Anyway, this experience left me extremely cautious about introducing any external code (as opposed to libraries) into a codebase. OSS libraries with permissive licenses (MIT, BSD, etc) are easy to deal with: it's straightforward to comply and being a library means the code is nicely compartmentalized if you need to replace/remove it. [1] https://opensource.stackexchange.com/q/1717 https://opensource.stackexchange.com/q/1717
- hootbootscoot 6y agoThat tool sounds properly dodgy too. Wouldn't their indexing of S.O. answers be itself an IP issue?
- smitop 6y agoUsing SO data for purposes like that is allowed under the CC licence used. You don't even need to do any scraping, since you can download an offical data dump of all SO answers at https://archive.org/details/stackexchange https://archive.org/details/stackexchange
- stadium 6y agoI closed the page in frustration when I got this popup to subscribe and haven't been using it as much since. I thought it was real. Or maybe it was and this is damage control?
- alfiedotwtf 6y agoI've seen more than one Stack Overflow answer straight copy-pasted into a single function, much of it leading to dead code anyway, and not cleaned up before being pushed into production.
- fouc 6y agoIt would be interesting to see cases where the most upvoted answer isn't actually the most copied answer. Stackoverflow could potentially rank highly copied answers higher.
- raspasov 6y agoQ: How often do people copy and paste from Stack Overflow? A: Very rarely. And when I do, it really depends on the language. If you find a solution for Clojure, chances are it's pretty high quality. The fact that the language has been essentially stable for 10 years helps. The language culture around minimizing complexity and a strong preference for pure functions also doesn't hurt. For other more "churny" & mutable languages you gotta be careful. It could be a good solution, or it could be old, unwieldy or excessively complex.
- aussieguy1234 6y agoAfter 10 years of coding I visit stack overflow less and less. In fact when I first started there was no stack overflow, we had to rely on Google. I find it useful to educate other engineers on best practices. There are good posts on MVC, SOLID, TL;DRs of popular books like working effectively with legacy code etc. I find it useful to see how different people have approached the same problem. I'll generally look at multiple questions and answers before deciding on my own approach (not necessarily the ones I saw on SO).
- renewiltord 6y agoAll the time, man. I cargo cult the fuck out of the following: # https://stackoverflow.com/a/246128 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" is a
- Xavdidtheshadow 6y ago> UPDATE: There has been a lot of interest in purchasing a real life version of our prank. The good news is we anticipated this might happen and we’ve been working on something along these lines. Stay tuned for more! Nice! I thought it was a cute idea and I like little useless hardware.
- supermatt 6y agoIm honestly surprised that people use stack overflow any more. In the early days, I gained a large amount of reputation both answering and asking questions. It felt like participation. Now it is almost impossible to ask a valid question without it getting flagged for some reason. Questions are closed as duplicate, when they clearly aren't. If you follow the "new" feed, you can see valid questions getting closed before your eyes. Now I just stumble on it from google searches - and most of the time the answers are of poor quality, or to do with an outdated language or product feature. It is sad, because it was an awesome Q&A site.
- shannifin 6y ago> "One out of every four users who visits a Stack Overflow question copies something within five minutes of hitting the page." Ha. Before reading the article I thought to myself "I probably copy about 1/4th of the time..." Usually just syntax I can't keep straight.
- beermonster 6y agoCheck out this scary VS extension then! https://marketplace.visualstudio.com/items?itemName=Alexey-Strakh.stackoverflow-search https://marketplace.visualstudio.com/items?itemName=Alexey-S...
- deleted 6y ago[deleted]
- docflabby 6y agoThe quality of SO has deteriorated rapidly over the last few years. I think the rot started when they brought I the careers section. People more interested in gaming it to get a job then help each other out.
- ai_ia 6y agoI don't always copy code, but when I do it's always regex !
- StreamBright 6y agoWay too often. One of the bugs I had the opportunity to debug was caused by a frontend developer who copy pasted invalid JSON from SO and pushed it all the way to production. He used different quotes: “ ". When the data did not show up on the dashboard he just put the blame on the data team.
- dusted 6y agoI don't copy and paste from SO. I sometimes type what is shown on SO, but not copy/paste, this just sits better with me, I get a deeper appreciatio of what it's doing even if I've read the code and understood it well, and it lets me use names that fit with the program and context of what I'm doing. Often, I use the example on SO not as the solution, but as inspiration for one, and so I type only a modified subset of it, and at that point, it's just a lot easier to type it yourself than to copy/paste/modify it anyway.
- JoeAltmaier 6y agoStack Overflow suffers from Internet Ossification. Thousands of posts in the search engine but most are for obsolete questions. So lots of chaff shows up. Sometimes its a melancholy thing - looking for a latest-version issue and some 12-versions-back question shows up from 2002. Still unanswered and I think of that poor soul still hoping for some direction after all these years!