6 ms·
I kinda disagree with the implied notion that there's only these two options mentioned in the article: A) blindly copy paste whatever code shows up on stack ove
by hooby 5y ago
I kinda disagree with the implied notion that there's only these two options mentioned in the article:
A) blindly copy paste whatever code shows up on stack overflow without even trying to understand it
- or -
B) don't ever look up stack overflow at all.
I'll keep doing what I've always done:
Look things up on stack overflow (and other sites), compare different answers and check the discussions as well, figure out WHY people are doing what they do - and then do my own experiments based on that.
For me personally, this leads to faster learning results than experimenting completely on my own, without any guidance.
- dfxm12 5y agoYeah, this quote: trying to find some kind of shortcut to just get my code working by copy pasta-ing random bits of spagetti and crossing my fingers. Stop. There’s a better way. is about as honest as the Juice Loosener pitch from the Simpsons [0]. It's impossible to be able to just copy and paste something you find online and have it work, especially while ignoring all context and learning nothing. 0 - https://www.youtube.com/watch?v=kDiSWKaS3N0 https://www.youtube.com/watch?v=kDiSWKaS3N0
- gopher_space 5y agoThe article seems geared towards someone working from a book or guide at their leisure. Building things up from first principles is a great way to learn but I personally never have time for the approach on the job.
- DemocracyFTW 5y agoI think what the article does get right is a fundamental technique to solve a problem when you're stuck: reduce to the essentials, get your terms / naming things right, write a teeny self-contained thing (I call it 'building a model') to try it out. When the solution is understood and has proven to work, integrate. Especially when you're hard pressed for time, this may prove faster overall than the approach where you fumble with many screws.
- lostcolony 5y agoYou don't even need to compare answers, per se. I use SO as a way to know what documentation to check. That is, if I want to X, the official documentation is oftentimes extremely difficult to parse through; to do X you have to instantiate a Foo, with an instance of Bar, etc etc etc, and all you have are API level docs. They're usually written the reverse of what I need to solve the problem (given function X -> understand what it does, rather than given what I want to do -> use function X; this gets even worse when you get higher level concepts, where what I want to do -> implies doing 4 different things in this API -> 4 different functions/data types that need to be strung together). SO and its ilk give me an example that I can start to cross reference with the API level docs, to figure out how to pull it all together, and also where to look to find the "gotchas", tweaks, and options.
- dfinninger 5y agoDefinitely. Although one of the reasons I do check other answers is that (at least for Java) the accepted answer is oftentimes Java 8 and then one of the other answers has a Java 11+ version that is half the LoC.
- stinos 5y agoThis. Even if the solution you come up with in the end is almost literally copied from SO, you'll still have learned something and saw different ways of doing things, which is often more valueable than just writing up a naive but working piec of code. Nothing wrong with that, but especially when still learning a language it's more interesting to figure out the typical way of doing things because you'll come across them again and again. Hence also helps reading other code which uses these constructs. And once you know them they're often faster to write and easier to read/grasp.
- georgemcbay 5y ago99% of the value of StackOverflow for me as an older developer is just finding workarounds to bugs in platforms/APIs/tools that people have run into before me. Example: Compiler throws error 0x19822943 on what looks like valid code. Googling the error code along with the compiler name almost invariably returns stackoverflow results near the top, so I look at the post(s) with answers and see "Oh yeah this is a known issue, upgrade to version 1.29 and it goes away". For all the issues I have with the site it is still pretty great for these sorts of problems that should be covered in the support documentation for whatever it is that failed (but often isn't -- or isn't in a way that google is likely to find it easily).
- jonnycomputer 5y agoalways read the discussions; and the different answers; and any answers linked to too. and check the date too.
- rbanffy 5y ago> and check the date too. This, a billion times. I wonder if there is a way to voluntarily downrank pages in search engines so that answers that are obsolete do not show up first in results. If I'm having issues with Ubuntu 22.04, the solution to a similar problem in Ubuntu 10.04 is very much likely to be wrong.
- notreallyserio 5y agoI would be happy enough if Stackoverflow put as much emphasis on citing version numbers as it does the less critical x-y problem. At least the former benefits future readers.
- jonnycomputer 5y agoYeah, version info is more important than date, really.
- remram 5y agoI go one further. If I do use a piece of code from Stack overflow (usually a workaround for some API pain point or specific technical gimmick), I linked to the answer from a comment. I then built a tool to notify me if that answer gets new comments or new answers are added. [1] Similar to how I check for new versions of my npm/pip/gem/cargo dependencies, I check for new info on my Stack overflow dependencies. [1]: https://github.com/remram44/depoverflow https://github.com/remram44/depoverflow
- Larrikin 5y agoI link to SO in a comment if there's some bug I'm working around or similar with an explanation about why a strange code snippet is doing something that looks strange. There is usually a TODO so that the code can be removed when the bug is fixed.
- remram 5y agoThat's good too, I just find personally that in larger codebases, those TODOs tend to stay forever.
- johndubchak 5y ago>> I kinda disagree with the implied notion that there's only these two options mentioned in the article I took that away from the article as well, although I doubt that is the author's original intent. One thing I like to do, if I have the extra time, is pull out a couple of different algorithm's books (Cormen always being one) and see if I can find a new way of viewing a problem in light of an "algorithmic approach." Admittedly the research takes time and is always a lot of fun as I explore many other "rabbit holes" but it leads to other insights as well. The thing I will try to do is capture a few bullet points that I may have gleaned during this exercise. The approach is not conducive to goal, or time, sensitive deadlines, however.
- cassandratt 5y agoI have a rule about ZERO copy-pasting from SO or anywhere else on the internet for that matter. If you don't understand the code, when you have all the time in the world to understand it, seek help, test it, and figure it out; you certain won't suddenly understand it better, when it breaks in production. Just because 100 idiots upvoted something, doesn't make it right. Personally, I avoid SO because I've seen too many wrong answers. I prefer documentation, or blogs explaining approaches. But, it can be a resource, especially to new developers, to help you understand how you need to think and how to approach problems. As a replacement for coding it yourself, it's might be hot garbage, so you should understand it before committing to having produced that code and assign your name to it.
- vanusa 5y agoI prefer documentation, I do too, in theory. In reality though, 90 percent of the time it's essentially unnavigable / unsearchable / basically intractable to use. What you want is simply something that tells you "how do I do X" where X is some real-world thing, like strip the end-of-line characters from a file. What you get from "documentation" as such is a huge sprawl of text explaining the guys of 90 different command line options. Good luck digging your way through that. Imperfect though it is, SO was created to address precisely this huge, gaping disparity between what users want, and what most "documentation" actually delivers. Did I mention it's imperfect? And that you actually have to (shudder) think about the examples given, before randomly cut-and-pasting them into production? The whole point is though, that it's better than nothing, and frequently is mostly correct (and it's not that hard to tell when the answer is wrong or requires a bit of fine-tuning for your use case). And at the end of the day, still saves me hundreds of hours compared to the nearly useless "documentation" that ships with most running languages and platforms these days.
- cassandratt 5y agoI prefer to hire programmers.
- deleted 5y ago[deleted]