5 ms·
> homework assignment for all programmers reading this thread: Think about how you'd find this bug in your own programs. You copy/paste the code, it seems to wo
by kstenerud 7y ago
> homework assignment for all programmers reading this thread: Think about how you'd find this bug in your own programs. You copy/paste the code, it seems to work, and you don't realize it's broken because you don't run either of these programs which made the same mistake.
Wait... WHAT??
Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing, how and why the pieces fit together as they do, and how it works as a whole to solve the problem?
- chrisoverzero 7y ago>Who the hell copy pastes code into their program without […] The developers of Docker for Windows and the Razor Synapse driver management tool. Among others.
- ghostpepper 7y agoHeh, I read your comment after I posted almost the same thing word for word.
- meddlepal 7y agoI used to work with a "senior developer" that was making well over 150K several years ago that basically just verbatim copy-pasted code off StackOverflow and hacked it together. He got shit done and that was what mattered to his bosses... of course it was all a steaming pile of unmaintainable garbage but that didn't matter to anyone. If he couldn't find it on Stackoverflow he would ask another developer who would tell him how to do it... then Mr Senior Developer would ask that other developer if he could just "send him the code". Last I heard he's still at that company and still making bank doing nothing but copying and pasting other people's work.
- bloopernova 7y agoI know a coworker whose cloudformation code I have had to fix multiple times because they've done just that. Googled "how to do $problem" then skimmed over the first result and copied the code from it. It's been raised with management, and nothing has been done about it.
- mperdoni 7y agoThere seems to be a suspicious rise of acceptance for this "practice". It's very concerning. I've never found a SO answer to be copyable, they are usually wrong or flawed. Usually have to dig in all the responses to get a balanced overview, then apply those concept(s) to your problem at hand....
- ghostpepper 7y agoDevelopers at Docker and Razer, among others.
- P_I_Staker 7y agoLots of people, sadly
- deleted 7y ago[deleted]
- _rrnv 7y agoyou forgot to add /sarcasm
- cstuder 7y agoSay hello to `pasteoverflow`: Paste code from Stackoverflow directly into your editor. https://marketplace.visualstudio.com/items?itemName=matsz.pasteoverflow https://marketplace.visualstudio.com/items?itemName=matsz.pa...
- mperdoni 7y agoCan it go one meme-step further and automate our jobs away? ;)
- stmL 7y agoDoes this work ? https://github.com/drathier/stack-overflow-import https://github.com/drathier/stack-overflow-import
- maest 7y agoReminds me of this beauty: https://gkoberger.github.io/stacksort/ https://gkoberger.github.io/stacksort/
- XCSme 7y agoPlease stop :(
- tinus_hn 7y ago> Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing The people who write the software that runs the airplane you’re on.
- mcv 7y ago> "Who the hell copy pastes code into their program without first examining..." Quite a lot of people do that. It's pretty much the reputation of Stackoverflow. And of course everybody knows it's bad, but it saves time and it works and there's deadlines so they move on and ship it to production. How to find this particular bug is not that hard, though: you're looking for a way to ensure that your program can run only once, so you use that mutex. But you want to be sure that mutex is unique to your program and not shared with others that use the same method, so you create another program that uses the same method and test if they conflict. If they do, then your mutex is not unique to your program.
- JeremyNT 7y ago> Quite a lot of people do that. It's pretty much the reputation of Stackoverflow. And of course everybody knows it's bad, but it saves time and it works and there's deadlines so they move on and ship it to production. The trick of it is, it's only "bad" if you care about code quality and/or maintainability, fuzzy attributes which are seldom measured or optimized for. It's the only logical conclusion to "move fast and break things." p.s. - the good news is, most of us are working on software that doesn't really matter terribly much, so the fact that it's bad also doesn't matter very much
- viraptor 7y ago> If they do, then your mutex is not unique to your program. Unfortunately, if they don't, you only know that there exists one program which does collide with your app's mutex. Nothing more, nothing less. > But you want to be sure that mutex is unique to your program This one's actually impossible to test. Or to be pedantic, we know it can't be done - another app can be using your app's guid for its mutex, but in realistic cases, it's just really hard to test for. There could be even a real use case for collision - independent agents walking the process tree and relying on locks based on guids to not step on each other.
- mcv 7y agoIt's not a true proof that it's unique, but if you have two programs use the same method to generate that GUID and end up with different GUIDs, while different instances of the same program get the same one, it's looking pretty likely that they're unique to the program. Going beyond that is only really interesting to mathematicians.
- viraptor 7y agoIf you haven't seen stacksort yet: https://gkoberger.github.io/stacksort/ https://gkoberger.github.io/stacksort/
- raxxorrax 7y agoWell... laziness is the mother of invention or something like that. Has anyone about 40 lines of code with an average line width of 80 characters? I have this rather spare region that doesn't look nice on the mini map. But seriously, I think the reasons are mundane and developers often have an ample list of problems to solve, so easy solutions for some of those are used as much as possible. Ensuring only one process runs at a time is probably just a feature that invites negligence. It shouldn't happen, but I am not surprised.
- coldtea 7y ago>Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing, how and why the pieces fit together as they do, and how it works as a whole to solve the problem? Almost everybody at some point or another?
- Havoc 7y ago>Who the hell copy pastes code into their program without first Millions upon millions of people learning via googling But yeah hopefully not in production & ideally sandboxed
- asynch8 7y agohonestly, i think it would be easier to count the people that DO read every thing line of code they copy