1. 48
    1. 47

      A lot of programming is ritual. I know what I need to get done, I just need to get the magic incantation to get it done in language X or in framework Y or with tool Z. There is often not much thinking involved. I’m not looking at stack overflow for “how to do breadth first search”. I’m looking on stack overflow for “squash commits” because I don’t do it often enough that I’ve memorized the particular incantation I need to do it with the versioning system I’m currently using. Or, to paraphrase Holmes, I use stack overflow because I have more important things to put in my memory.

      1. 3

        I know what I need to get done, I just need to get the magic incantation to get it done in language X or in framework Y or with tool Z. There is often not much thinking involved.

        I think it depends. Each language, framework or tool has its own flavour, its own way of doing things. If you regularly use a language/framework/tool, you should understand clearly how a certain thing can be done with it and why it is done the way it is. The solution should not be a magic incantation, as you call it. On the other hand, if you use that language/framework/tool sparingly, it is perfectly acceptable to do something with it and treat it as a magic incantation.

        Other than that, I completely agree with everything else.

        1. 16

          If you regularly use a language/framework/tool, you should understand clearly how a certain thing can be done with it and why it is done the way it is.

          I am a long-time contributor to Django. I’ve written both code and documentation for it. I’ve served on the framework’s technical board. I’ve written articles on it and books on it. I’ve given advanced seminars on it that peek under the hood into how it works at a deep level.

          I still routinely have the Django documentation open in a tab when I’m doing something that involves Django.

          1. 1

            Of course, you don’t remember everything, and that’s human. But I bet you understand what you search and find in the documentation, and that’s what I was saying in my comment.

        2. 11

          I don’t know; I’ve been programming Go daily for almost five years, and sometimes I almost know how to do something, but either 1) can’t remember something simple, like the specific package a function is in, or 2) just can’t be arsed to do it myself and it’s easier to copy/paste some lines of code from the first search result.

          So, for example, I could write a simple function which, say, returns a random element from an array; it’s just a matter of looking at the documentation and finding the best function. Or … I can just look it up (and possibly choose the best option out of several). It saves me the time and brainpower about thinking about all of this, since there’s probably a few ways to do it wrong too I have a higher chance to get it right (not that SO is always correct either, of course, but at least it has some feedback).

          With Python or Ruby this is even more helpful, as they have a larger standard library and many more useful helper functions for stuff like this. It’s hard to remember them all.

          It’s a “magic incantation” not because I don’t understand it or because it’s “magic”, but because what I’m really focused on is not choosing random elements from an array, but solving some real-world problem. The “magic incantation” is just plumbing to get that job done and I’d like to spend as little time on that as reasonable, so I can actually solve useful problems.

          1. 4

            I agree, what you described doesn’t fall into the Stack Overflow Antipattern. During the process you understand what you’re doing, you’re just delegating some small tasks to other minds (users who had posted answers on SO, for example) in order to solve the problem you’re tackling faster.

            Maybe I wasn’t 100% clear in the comment I made above (and in the post in general), however I was not arguing that programmers should remember everything they need and shouldn’t seek information online. What I was saying is that they should understand what they’re doing (at different degrees, it depends on a lot of different things: e.g. time available or, as you said, how much a problem is tied to the real problem I’m working onto) and not use online resources mindlessly. It is important to understand when searching is a good choice, and when it’s not. If you do that, then you’re using SO (and online resource in general) in the right way.

    2. 19

      “The root cause is a lack of thinking.” We would all like to appear pro-thinking.

      I’d suggest the root cause are time constraints.

      1. 3

        A lot of the reason I’m checking Stack Overflow is (1) the docs for tool/framework/library X are horrible (2) this is the umpteeth tool/framework/library/build system/command line tool to do thing Y I’ve used and can no longer keep everything I need in my head.

      2. 2

        I would like very much to join the “We would all like to appear pro-thinking” party! Or can we get that added to some group’s platform?

        Limiting our sophistry to at least appear in favor of thinking is something we should all be able to get behind.

        1. 10

          We’ll have buttons that say “I’ve thought about it!”

        2. 4

          I don’t know… I’d at least like to wait until my preferred political party or favourite celebrity endorses this “pro-thinking”. I don’t want to go chasing fads.

          1. 3

            That could be another party slogan! “I don’t know…. I don’t want to go chasing fads”.

      3. 2

        and time constraints come from need for profit. The market economy is incompatible with good code.

        1. 18

          That’s ridiculous. Time constraints can come from anywhere and trying to use it as a dig against market economies is tenuous, at best.

          1. 2

            Then it might be by chance that the software world is in a terrible state and the more money-constrained enterprises produce the worst software.

            Anyway could you tell me where time constraints would come from in the current production mode?

            1. 7

              A limited lifespan in which to do what we must do.

              Many of us are keenly aware of our impending end of file.

            2. 4

              It’s not obvious to me that more money constrained enterprises do in fact produce worse software in general; or even that software can be ranked on a single good-to-bad axis irrespective of the goals of the developers and users of that software. I don’t see the amount of money an organization has as being particularly related to how good their software is, or even see that as a particularly relevant question, given that an instition might want to use their money to produce software that does what they think is good rather than what I think is good.

        2. 6

          I generally have a lot more time to spend on code I’ve written while employed than code I’ve written in my spare time.

          1. 1

            that probably means your company has no pressing need to deliver new and unfinished software and it’s healthy enough not to pressure lower layers in the hierarchy into working crazily even if unnecessary.

            1. 4

              My personal experience is that time constraints are rarely the reason for bad software; rather, a number of organisational and/or historical reasons are. Writing bad or good software usually takes about the same time Actually, writing good software is usually faster if you take the long-term view, and I think most people understand that.

              The “write once, never look back” coding CEO, that kinda clueless coworker who doesn’t quite seem to know what they’re doing, that asshole coworker who absolutely insists on rewriting everything in their preferred way as that’s the One True Way, that other team in the other city which was recently hired and doesn’t understand the context, changing requirements or directions from management, the customer, or legislation, unclear requirements, a generally toxic work environment which leaves everyone demoralized, someone deciding we should follow latest fad X. Stuff like that tends to be a far larger influence in my experience.

              Of course, I’ve only worked in five companies, so it may be different in other companies. But this is my experience based on those five companies.

            2. 2

              Or you could accept the market forces at that place converge on “do it better.”

        3. 2

          Which explains why all the good software comes from north korea, the soviet union and pre-reform china…

          1. 1

            no but a lot of good software comes from research centers, foundations, public institutions, where the priority is on quality, reliability, correctness, fairness and developers are free to work without being directly exposed to a market-driven feedback loop. That doesn’t mean that these institutions are not immersed in a market economy, but that they invest resources in shielding some people from these pressures in order to be able to produce a kind of quality that is not possible otherwise.

            1. 2

              And these research centers, foundations, public institutions are of course located in societies with free(-ish) markets.

              1. 1

                yeah but they can produce that software despite the market, not thanks to the market. The way they get funding and allocate resources is in response and opposition to the market needs.

                Peer 2 Peer production is also done in societies with free markets, but they work really hard to try to escape it. It’s a bug, not a feature.

      4. 1

        Even when I don’t have a time constraint set by some sort of external party, I still get stuck in the trap of searching Stack Overflow and becoming more and more frustrated (although this usually happens with infrastructure and deployment problems, not actual programming issues).

    3. 15

      I appreciate this article as a reminder to not mindlessly use what you find on the internet. But, I generally find that I only use stackoverflow and other forums for very specific language/framework solutions, like “how to concat a Lua table to string”. These forums are rarely useful for solving the business/application problem I am dealing with and that’s where the bulk of my “thinking” goes.

      1. 6

        I think that’s a big use case for me as well. I know how to do X, in language L1. I even know how to do it in the language L2, but I don’t know if it’s idiomatic or will the people cringe. Like, when reviewing frontend commits made by Java devs. Yes, it works. Yes, their table is properly sorting. But did they really need a “TableSorterFactoryBuilder” for that?

        1. 2

          Eventually the == and is and not= and not just flow together. Sometimes I remember which it is in languages I use less.

      2. 4

        A lot of the questions I ask of stack overflow are of the type “which of .len() .length() len() is the one the language I’m using today uses for getting the length of a list?”

        1. 1

          I find it far quicker to just look in the documentation for whichever language I’m using today.

          Sometimes I also happen across useful bits of information in the documentation too, like “only use this method in these cases, for other cases this other method is more performant”, etc. You might get answers like that in SO, but more often than not they are buried as some comment to an ‘answer’ or at the very bottom of the page.

    4. 8

      I find that I don’t use SO obsessively to avoid thinking, but to patch over bad or missing documentation or features.

      Usually I get stuck at an obstacle like “I want to make a deep copy of this struct. That should be a simple, common operation, but i can’t find it in the API. Is it a terminology thing? Does this language not call it ‘deep copy’?” Then I punch “how to deep copy in foo language” into google and SO appears with a set of interchangable complex workarounds because the feature is actually missing from the language.

      In fact, I often think that if language/library authors saw some of these highly-upvoted questions, they’d have a pretty good prioritized task list of possible improvements.

    5. 4

      Another favorite is googling, finding the entry on SO … then realizing that the answer is wrong. It was wrong, but it was provided by somebody with a good rep on SO. SO is a social curation engine, not a teaching platform.

      I think we reached some sort of local maxima in not-thinking with the launch of Quora, which allowed you to ask most anything. “What makes a good life?” and so on. The underlying premise of all of these sites is that whenever you’re in need, as long as you are able to type in a query string that somewhere, somehow, there should be some sort of answer for you.

      Like everybody else, I rely heavily on Google when I get stuck, but I always keep a watch out for a possible underlying problem do I understand what I’m doing with the machine?. If I have a good internal mental model of the machine and what it’s supposed to be doing, then I’m just leaning on the web because I forgot a few details. But if the answers I’m looking for start involving a lot of concepts I haven’t been thinking about? I have another sort of problem completely from just how to make the error go away. That’s a signal to deep-dive.

      1. 5

        Another favorite is googling, finding the entry on SO … then realizing that the answer is wrong. It was wrong, but it was provided by somebody with a good rep on SO. SO is a social curation engine, not a teaching platform.

        Stack Overflow does have tools to correct these issues: if the error is minor you can edit the answer. Or if it’s more major, you can leave a comment explaining why it’s wrong. And, of course, you can downvote it.

        I don’t have the impression that people “vote on the reputation of the user” per se (although this probably happens sometimes); it’s just that high-rep users tend to post more answers and everyone is wrong sometimes, so it’s only natural that wrong answers are not infrequently posted by high-rep users.

        1. 2

          That’s a very interesting idea. Perhaps I’m wrong. Your point certainly makes sense.

          I guess the question depends on which behavior is more common: a frequent user making a mistake now and then or other users voting up something that looks correct but isn’t based on how the answer “looks” to them (status of poster, phrases used in the reply, length of comment, and so on).

          Might be a good academic study in there somewhere!

          1. 1

            One of the major problems with SO seems to be that Spolsky and Atwood wanted it to be a wiki but wanted to gamify contribution and never harmonized these aspects of it. There are more incentives to leave snarky comments on wrong answers or provide alternatives than there are to correct close-but-incorrect ones with the result that you often don’t see convergence on an approximation of “right” but rather just a bunch of arguing. I also suspect that they overestimated the wisdom of the crowd in how voting is handled (just look at the arguments ad nauseam on meta stack exchange about the voting system).

    6. 3

      I don’t think it’s even feasible that you’d find a solution on stack overflow for a business problem in most cases. I don’t think this is a real problem that I’ve seen. Many of the full solutions seem to be written up as answers to a homework assignment, not a general case you’d see at work.

    7. 3

      Here’s my problem with this kind of post (yes, it’s a kind: I think I’ve lost count of how many iterations I’ve seem by now):

      1. It’s a generalization over personal experiences of other people. I.e., the author is making comments about behavior he has seem in other people, which has two issues:
        1. We’re usually way less forgiving to other people than to ourselves. When we look up something on Stack Overflow, it’s an efficient use of resources, we’re not gonna reinvent the wheel here, we have business problems to solve! When other people do, they’re lazy and not thinking hard enough about the problem at hand.
        2. Last occurrence bias (this is probably not the right name but I can’t be bothered to look it up): The author probably feels, likely, strongly, that he’s seem this kind of behavior in others, and a lot. I bet, though, that if they try to actually write down the actual instances of said behavior, it will be a somewhat underwhelming number.
      2. This is advice that will probably miss whoever needs it, and instead hit (and hurt) the people who least need to hear that they shouldn’t look things up: beginners, specially beginners of underrepresented minorities. People that copy and paste mindlessly from Stack Overflow hardly will stop to read a long post and they think about it, have some introspection, and realize they need to change their ways. Beginners, though, being already insecure, might take away the wrong thing and think that they’re even more useless than they already feel.

      Some, in short, this kind of post is likely an exaggeration over personal experience, and will hurt more than help people who read it.

      “Well, that’s nice, but I actually saw a person doing this the other day, so what do you suggest? Should I just let them ruin the codebase with crap copy and paste from SO?” Glad you asked. Coach them. Directly. Act on the actual instance of the issue. Maybe even send them this post? At least it might do some good, then. But ranting about it online will pretty much only miss the target and hit “innocents”.

      Disclaimer: I might very well be incurring in 1.1 and 1.2 myself, so, take this with a grain of salt.

      1. 2

        It’s a generalization over personal experiences of other people. I.e., the author is making comments about behavior he has seem in other people

        Actually, it’s a generalization over my own personal experience. I don’t work in a tech company and I have very few friends that are into programming, so I don’t know the behaviour of other people in this regard. In fact, nearly all the post is written in first person!

        People that copy and paste mindlessly from Stack Overflow hardly will stop to read a long post and they think about it, have some introspection, and realize they need to change their ways.

        This could be true.

        Beginners, though, being already insecure, might take away the wrong thing and think that they’re even more useless than they already feel.

        Hopefully beginner programmers can read an article and understand its meaning! I think I emphasized enough the idea that Stack Overflow should be used, it just shouldn’t be used mindlessly.

        All in all I believe that it is true that the article is pretty generic, but it’s the way I wanted it. I also believe that it can either be useless or useful, depending on who reads it, but not harmful.

        PS: I’m glad you liked the theme of my blog (at least :P). It is a Jekyll theme and I made it available on GitHub. Here’s the link if you want to check it out.

      2. 1

        PS: Loved the theme on your blog though, might steal it =)

    8. 3

      I don’t have a problem with most use of Stack Overflow, because I mostly see it used to find infrequently-used corners of a language or standard library. E.g., I end up on Stack Overflow a lot when searching for things like “how do I convert a string to a Python datetime again?”, or “what’s the obscure git incantation I need to merge two repos?”

      In other words, Stack Overflow compensates for the fact most documentation is not written in Q&A format ;-) and isn’t terribly searchable.

      I mean yes, it’s a problem if you copy-paste code but don’t understand it. You should be able to explain your own code during code review, and if you can’t then it shouldn’t be there. But in practice I have only seen this happen a few times, and I think it’s a rare issue.

      1. 1

        To agree with the “not very searchable” point, I find it annoying how often Google ranks only-vaguely-relevant SO questions, blog posts, and twenty different web versions of old mailing list messages higher than the documentation that directly answers my question.

        1. 3

          On this regard, someone here posted https://quickref.dev/ a little bit ago. I’ve been using it and it’s replacing a very good chunk of my googling. I did not manage to make it muscle memory yet, but if I don’t find anything worthy in the first google page, it is the next stop.

      2. 1

        It would be quite nice to have a Q&A-style section in the documentation that gives some common use cases. Then you could even put unit tests on the code there, to make sure the answers still work for every release.

    9. 3

      Surprised no one has mentioned P != NP.[1] We should go to StackOverflow when recognizing a correct answer is easier than producing it. Both provide a form of knowledge.

      [1] Surprised as in not-surprised. This analogy is probably 100 different kinds of flimsy.

    10. 3

      I think the issue is somewhat buried in “I find a seemingly-satisfying solution (usually on Stack Overflow)”. If you find something on SO and do your due diligence to think about how it works and why, this problem will be much smaller. And you can also learn things from answers that are wrong or don’t work.

    11. 2

      I can definitely see what the author is saying. I spent almost 2 hours “debugging” by doing printfs and looking around on StackOverflow last night. Wound up fixing the problem in a 20 minute gdb session. We can get really hardwired to simply trawl the Web for a solution instead of using tools to take a deeper look at what our issue is and think about it for a bit.

    12. [Comment removed by author]

    13. [Comment removed by author]

    14. 1

      I would estimate that at least 80% of the time the answer you are looking for is in the official documentation. Some people rely so much on SO they never learn how to navigate the official docs. I would recommend to install a tool such as Dash and avoid the impulse of googling before looking at the docs.

    15. 1

      What about the asking on IRC propattern?

    16. 1

      These days I usually find myself googling because I’m trying to do X but something new has gone wrong in the environment and I can’t even get started on X. An update to some dependency (or to xcode) happens, and pow you can’t lerna bootstrap any more to pull down new deps, because there’s suddenly a cryptic error from a C compiler or a header file is missing or something, and then you’re wasting 2 hours trying to just get started.

    17. 1

      Defining antipatterns considered harmful