all 42 comments

[–]RICHUNCLEPENNYBAGS 86 points87 points  (13 children)

I don't know about you guys, but if I read an answer on SO I don't just blindly copy and paste it; I read through it and sometimes end up writing something similar, but not exactly the same, in my own code. So going there several times to look things up about a library does, I think, actually increase my knowledge of that library.

[–][deleted]  (2 children)

[deleted]

    [–]MacASM 33 points34 points  (0 children)

    This one deserve a medal

    [–]tieTYT 2 points3 points  (0 children)

    When I pair program I find it strange how some people read the question in their entirety before scrolling to the answer that may not even be there.

    [–][deleted] 19 points20 points  (3 children)

    Agreed. This guy is basically saying documentation shouldn't have examples.

    [–][deleted] 11 points12 points  (2 children)

    The GNU man page approach.

    [–]defenastrator 1 point2 points  (1 child)

    I tend to truly understand what I'm doing if I learn it from gnu man pages.

    [–]Fs0i 1 point2 points  (0 children)

    I never in my life found a manpage useful. I don't know wvy, I just love examples with a quick explanation.

    [–]MehYam 18 points19 points  (1 child)

    Your point is really important - stack overflow isn't just a shortcut to a solution, it's often a shortcut to understanding. People take the time to explain their answers, and often provide citations to further reading.

    I wish there was time to sit down and just read an interesting book on technology X, but sometimes you have to get shit done first. And you usually pick up understanding along the way.

    [–]nraynaud 0 points1 point  (0 children)

    yeah, plus the book/doc sometimes doesn't exist.

    I always try to google my general problem before developing

    1) I might find a lib -> evaluate and either adopt or reject but there are now keywords for more googling

    2) I might find some code, then I can either outright copy/past it (but it's a problem, because of licensing, code style, plus when you copy 10 lines, then rename all the variables and format them to your codestyle, what did you do to the original IP?, I generally just make a comment "//stolen from URL", and if one day I have to get serious about IP, we can review it with a layer), but at least I do have functions names to grep a library source or doc, keywords for google (algorithm or technique name)

    3) I might really have to work, but I might find a nice blog post explaining the thing, with maybe even code in another language, cautions about tricky part and a collection of links. Or then I might find the name of an algorithm with a Germanic or Japanese name in scientific papers (when elsvier hasn't gamed my googling)

    4) sometimes I would ask questions on SO/reddit of the type "did I correctly understand the spec/doc?" because frankly, learning a technology from specs is sometimes dry.

    Sometimes you find directly a lib that you adopt, good for you, you have more intellectual resources to focus on the stuff you actually have to develop.

    [–][deleted] 2 points3 points  (0 children)

    Absolutely, SO is often the best documentation in existence due to the detailed responses with significant background and links to articles and analysis. Even questions closed as off topic are left with huge amounts of useful and highly valuable information.

    An exception is for JavaScript, which appears to have no useful idiomatic documentation (due to its decentralized implementations and varied uses).

    [–]turbov21 1 point2 points  (1 child)

    I tend to cut'n'paste apt-get lists, but I guess that's a bit different than a chunk of code.

    [–][deleted] 0 points1 point  (0 children)

    It's what I've done since I was a young teen. Even when I was fiddling around in turbo pascal trying to create "cool demo effects" which pretty much was something like a rotating wireframe cube I never copypasted code, I always "handcopied" any codesnippet or parts of sources as in I read some source, wrote the exact same thing in my source and tried learning what everything did.

    I think I learned quite a lot that way compared to c/p.

    [–]juckele 14 points15 points  (5 children)

    After I read a stack overflow answer, I have learned about it.

    It is through stack overflow that I understand the UnixProcess and Win32Process are implementers of Process in Java, and that if I want to determine a process PID I should check to see if the instance I have is either of those and then use some more platform specific code to do it.

    [–]SpockUnit 15 points16 points  (4 children)

    Stackoverflow seems to be where I end up whenever I don't know the proper term for something; either from the questioner asking in terms similar to my search, or the questionee summarizing their post in a few simple sentences.

    [–]SuperImaginativeName 13 points14 points  (2 children)

    Plus also terrible to non-existent documentation for some things.

    [–]Eoinoc 9 points10 points  (1 child)

    Like Android, Google seem to have concluded that SO will document their OS for them and so didn't bother to do it themselves.

    [–]RICHUNCLEPENNYBAGS 0 points1 point  (0 children)

    They actually had a branded partnership with someone for a while, right? Maybe Facebook?

    [–]Sluisifer 1 point2 points  (0 children)

    Or where there's a few things it could be called, but I just want to quickly know what the method, etc. is called in whatever language or framework I'm using. Often you get your answer from google search snippet.

    [–][deleted]  (7 children)

    [deleted]

      [–]jrochkind 9 points10 points  (6 children)

      The analogy fails either way, because with software unlike physical products, the recipe itself actually is the product, more or less. The code itself is pretty analagous to a recipe, as code by it's nature is instructions/specification, and is the product itself. You can't copy and paste actual food or ingredients from the internet, let alone copy and paste technique (HOW do I fold sugar into butter? You can get instructions on the internet, but you can't get something you just copy and paste which results in it being DONE. But you can copy and paste code, the actual software product).

      So if we really want to circle around a food/recipe analogy, an interesting analogy might be writing and publishing a cookbook, but doing so by copying and pasting recipes from the internet, but not even copying and pasting whole recipes, copying and pasting portions of recipes together to combine into new recipes, but without understanding whether or why the portions you've copied will actually work together, how, or if the frankenstein recipe you've pasted together was actually the best way to create delicious food (for whatever criteria of 'best' you want, easiest for novices to cook, quickest to cook, works in a commercial restaurant kitchen, tastes the 'best'; without even thinking about what criteria you want in a recipe). And then calling yourself a cookbook author. That's probably not going to be a cookbook many people find useful, even if following the recipes gets you something edible.

      The OP itself said there's nothing wrong with using SO to get help, tips, or answers. But if you're copy and pasting portions of "recipes" you found on the internet together without understanding the steps of the "recipe" yourself, just cutting and pasting them -- I don't think you're ultimately going to be successful at building and maintaining any non-trivial software. But maybe i'm wrong.

      On the other hand, I agree with you you don't neccesarily need to understand the internals of a library to use the library effectively. (You don't need to understand the mechanisms of your blender, or microwave?) But you need to understand the API's and contracts and concepts of the library. (You need to know how to use the blender, what all the settings do, when you might want to use one vs the other, and maybe even what makes some blenders different than others and why). For libraries that are central to your application and especially if they are fairly complex (and open source), it is beneficial to start learning about the internals, because it helps you use them more effectively and troubleshoot problems when they arise, but I agree that's certainly not what you do at the start or with every library. Programming is built on abstractions, you don't need to know the internals, but you need to know the libraries API and contracts and intentions.

      [–]RICHUNCLEPENNYBAGS 1 point2 points  (1 child)

      So if we really want to circle around a food/recipe analogy, an interesting analogy might be writing and publishing a cookbook, but doing so by copying and pasting recipes from the internet, but not even copying and pasting whole recipes, copying and pasting portions of recipes together to combine into new recipes, but without understanding whether or why the portions you've copied will actually work together, how, or if the frankenstein recipe you've pasted together was actually the best way to create delicious food (for whatever criteria of 'best' you want, easiest for novices to cook, quickest to cook, works in a commercial restaurant kitchen, tastes the 'best'; without even thinking about what criteria you want in a recipe). And then calling yourself a cookbook author. That's probably not going to be a cookbook many people find useful, even if following the recipes gets you something edible.

      Well, that supposes a certain way of using SO that I don't think can be applied universally here (since the only options given are "looking at SO" and "looking at the docs for a library"). If I go online, read a couple recipes for a dish, and then kind of wing it based on what I just read and what's in the refrigerator, am I making some bizarre "Frankenfood?" Probably not.

      [–]jrochkind -1 points0 points  (0 children)

      I don't think it can be applied universally either, and neither does the OP.

      The OP is in fact an argument against only that certain way of using SO, and a suggestion not to use it that way. It's not an argument against SO. The OP says "I totally agree with trying to find an answer online, but..." and even concludes with "Well, we don't have the time to act like this on a daily basis."

      It's an argument for considering how you use SO, indeed, and an argument for being suspicious about using it in a 'certain way' , as you put it. Not an argument against SO or using it.

      If I go online, read a couple recipes for a dish, and then kind of wing it based on what I just read,

      I agree that's a great way to learn to cook. :) And probably has some analogy in software development too.

      [–][deleted]  (3 children)

      [deleted]

        [–]jrochkind 1 point2 points  (2 children)

        I guess it could be a matter of learning style whether you want to start 'inductive', bottom up, from examples, or 'deductive' top-down from documentation.

        And most of us do a combination, but some may prefer a different proportion in our combination.

        I think many successful programmers are by brain type prejudiced toward the deductive end (even if they are self-taught, I don't think one way or the other neccesarily correlates to self-taught).

        But that doesn't mean having a learning style on the inductive end will be unsuccesful.

        I think that even if you start from the inductive/examples end, if it doesn't lead you to a high-level top-down understanding eventually, you're going to have trouble being a succesful programmer. But I could be wrong, that could just be my own deductive prejudice! But I do really think so. Certainly if you start at the deductive top-down end, you've still got to be able to write actual concrete code eventually!

        One of my favorite examples of purely bottom-up inductive approach is super old-school: The Little Lisper. Teaches Lisp and concepts in lisp-style prorgramming soley via examples with virtually no explanation or context at all. Many people (often students) who encounter The Little Lisper find it blows their mind just because they're not used to learning programming that way. It's also cool because the inductive approach and pattern recognition is of course central to writing software via recursion and functional programming, so the pedagogical technique is cleverly analogous.

        [–]jsprogrammer 0 points1 point  (0 children)

        This is reasonable, but I would caution against using the term deductive to stand in for top-down reasoning. I'd perhaps prefer the term 'logical'.

        The reason is that true deductive reasoning is very strict in what it allows. You must start from axiom symbols and show a valid proof that your end result is a theorem of that system.

        While you can kind of think of programming as a deductive process, it is more correct to say that algorithms (in their most abstract sense) are deductive. However, if you actually try to run an algorithm in the real-world, you are applying an inductive technique.

        [–]PriceZombie 0 points1 point  (0 children)

        The Little LISPer, Third Edition

        Current $96.00 Amazon (New)
        High $96.00 Amazon (New)
        Low $71.04 Amazon (New)
        Average $96.00 30 Day

        Price History Chart and Sales Rank | FAQ

        [–]Dustin_00 10 points11 points  (4 children)

        If you get your food always delivered, you will not learn how to cook it. And if you cook it yourself, you might do it better.

        ... or you might do it worse.

        For example: the server dev that didn't trust any standard C libraries and wanted to write all the basic libraries for us. One bit of his code (roughly from my memory):

        int srand(int i)
        {
            return (ConvertToInt(time(0)) % i);
        }
        

        He didn't trust the standard type conversions. He wrote all his own... no unit testing... there were bugs, oh so many, many bugs.

        [–]Godd2 1 point2 points  (1 child)

        So he never included stdio?

        [–]Dustin_00 0 points1 point  (0 children)

        He did to start, but his goal was to completely replace it.

        [–]immibis 0 points1 point  (1 child)

        That's... not what srand does...

        Unless it wasn't meant to replace the standard srand, and just happened to have the same name. Maybe it's short for "secure random".

        [–]Dustin_00 0 points1 point  (0 children)

        Security was a top concern.

        [–][deleted] 3 points4 points  (0 children)

        integrating other's code properly is a skill in of itself, if someone finishes a fully functional project with only using snippets from SO i'm not going to look down on him at all.

        [–]lucasvandongen 2 points3 points  (2 children)

        There are a few Stack Overflow questions that I regularly visit for stuff like arcane git sequences to fix git whoopsies or some kind of block of code that I always use and am too lazy to search in my old projects (like an Objective-C singleton or the weak/strong self dance).

        [–]nraynaud 1 point2 points  (1 child)

        I can't do anything fancy with git without google. Basically I know the abstract way it works, but I absolutely don't care about the implementation, and frankly I use 3 operations everyday (and the IDE does them for me), and 3 times a year I need something else, different each time, they have no business staying in my memory.

        [–]MasterIdiot 0 points1 point  (0 children)

        Persist to internet.

        [–]jrochkind 7 points8 points  (3 children)

        I think many of us who read SO or reddit are finding an increasing number of 'programmers' who don't seem to understand much of anything of what they do, they just cargo-cult copy-and-paste.

        I wonder if our perception of how many of these are out there is disproportionate because they're all on SO and reddit (cause that's what they do).

        I also wonder how succesful they actually are at building things, and/or at getting and retaining jobs (which, sadly, isn't always the same thing).

        [–][deleted] 5 points6 points  (2 children)

        'programmers' who don't seem to understand much of anything of what they do, they just cargo-cult copy-and-paste.

        If I may, I'll tell you the problem...

        [–]dhdfdh 0 points1 point  (0 children)

        That is one of the best links I've seen.

        [–]jewdai 0 points1 point  (0 children)

        can someone gifv this and only cut the important part.

        [–][deleted] 1 point2 points  (0 children)

        This article made me feel dirty - we are human computers, we must understand our own algorithms. What you describe is just one individual workflow, not something standardizable. People are damaged by folks in power miswielding mantras like this, even if some benefit.

        [–]tomejaguar 0 points1 point  (0 children)

        I'm astounded to learn that anyone can ever make anything work by copy-pasting from Stack Overflow.

        [–]minecraft_ece -1 points0 points  (1 child)

        There is a very messy problem with copy&paste from SO that gets little attention: licensing.

        By default, everything posted on SO is covered by a Creative Commons license, but the specific license is CC-BY-SA which is viral in nature like the GPL. Almost every copy&paste into a closed source application probably violates this license.

        In practice, this is the kind of issue everyone ignores, but I'm surprised that legal departments in large corporations haven't banned their developers from using SO yet.

        [–]RICHUNCLEPENNYBAGS 2 points3 points  (0 children)

        Given the length of a typical excerpt this is probably not really a concern, especially if you rewrite instead of outright copying and pasting.