by carlmcqueen · 5y ago · 0 comments
Many would ask to see the page I'd read and I'd show them and they would ask how I got my code working from an example that had nothing to do with what our task was.
I think there is a lot of value to looking at a SO answer, generalizing it and making it work in your code and doing it quickly. Knowing which SO articles are junk and which ones are gems is something many take for granted but is actually something close to having the right 'gut' feeling.
I don't remember the line of reasoning or detailed investigation that led to the solution, but I found something in a build configuration file that looked suspicious enough to warrant a search for an exact phrase in the code. It turned up a StackOverflow answer, where three lines had been cut and pasted into the build file.
There was some specific change in a library or binary upgrade that had broken the thing that this particular change was meant to fix, and the problem was solved by removing the lines in question.
The commit comment for these three lines was "merge hmmmm", which was also the only local documentation I found that I could have used to cross-reference with anything else.
Some point to that as an aspect of the replication crisis, but it's really just the nature of identifying and abstracting common elements out of specific goals.
This will probably get downvoted but I disagree with this.
IMO you should never be "generalizing" random pieces of code. What you should rather look for is help in augmenting your own logical reasoning process: e.g., I want to transform X to Y with BigO of Z complexity, how do I do that? Look for stuff that helps you understand how to do this. Once you do, you shouldn't need to generalize other people's code.
I don't mean to say that you should reinvent the wheel. Rather, you should understand that you need a wheel to solve your problem - where you get the wheel from isn't really that relevant (except for copyright, licenses etc but that's a separate topic).
Legal textbooks are the best example of a reference I've seen: the index is grouped by legal concepts and terminology, and is impenetrable to non-lawyers.
Like jargon, it gatekeeps; but that's not its only purpose.