Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Copy-Paste Coding Culture

Copy-Paste Coding Culture

Scheduled Pinned Locked Moved The Lounge
helpquestion
31 Posts 26 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jacquers

    I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #11

    As others say I'll also copy/paste code, clean it up, but I always take the time to properly understand [and improve to better fit the situation]. I'll never accept black boxes inside my source. If it's a somewhat significant "borrow" I'll leave a comment/partial url in my source referring back to where I found it and the authors name - even if I subsequently / substantially rewrite it. Why? starting from real/complete and working example: can try it, test it, and see what breaks it. once it's initially working then I'll refer to the dry msdn docs to fully understand the methods / return values / got-yas etc. After that very often I'll do a rewrite (and re-test) now that I have the "inner-mechanicals" in my head - to ensure I really do understand what's happening (and just in case it later breaks).

    Installing Signature... Do not switch off your computer.

    1 Reply Last reply
    0
    • F F ES Sitecore

      Me copy and paste code? I'm so hardcore I disable Intellisense.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #12

      You use an IDE? Shit, I used to write code in EDLIN. :)

      System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      M 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        I will use a "developed control" without looking too hard (or even at all :-O ) at the source code, provided it's from a source that I trust. But I won't copy'n'paste code - even small snippets - without understanding how it does what it does. If I don't, then I'm in the position of "then a miracle occurs" and I can't fix it in response to changes, or do it again next time something similar occurs. I do not understand the "grab random code from the internet and hope it works" mentality - it just seems counterproductive in the long term to me. I don't think it does "speed up development" - it gets you out of a hole right now, but drops you in a bigger one later on!

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #13

        OriginalGriff wrote:

        I do not understand the "grab random code from the internet and hope it works" mentality - it just seems counterproductive in the long term to me.

        I think that may stem from the mistaken belief that there is only ever one way to do something. A sure sign of someone who doesn't have much, if any, experience understanding algorithms and/or writing code.

        System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

        Click this: Asking questions is a skill. Seriously, do it.
        Dave Kreskowiak

        OriginalGriffO 1 Reply Last reply
        0
        • D Dave Kreskowiak

          OriginalGriff wrote:

          I do not understand the "grab random code from the internet and hope it works" mentality - it just seems counterproductive in the long term to me.

          I think that may stem from the mistaken belief that there is only ever one way to do something. A sure sign of someone who doesn't have much, if any, experience understanding algorithms and/or writing code.

          System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

          Click this: Asking questions is a skill. Seriously, do it.
          Dave Kreskowiak

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #14

          I know what you mean, and that just makes it even weirder - since it seems to be a "yoof thing" and they grew up in a much more "no-wrong answers" education system than we did. Or at least I did - there was one right answer and you were supposed to know it rather than work it out for yourself in pretty much all subjects.

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          P M 2 Replies Last reply
          0
          • D Dave Kreskowiak

            You use an IDE? Shit, I used to write code in EDLIN. :)

            System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

            Click this: Asking questions is a skill. Seriously, do it.
            Dave Kreskowiak

            M Offline
            M Offline
            MarkTJohnson
            wrote on last edited by
            #15

            EDLIN? Back in the day they only used zeroes, ones were too expensive.

            1 Reply Last reply
            0
            • J Jacquers

              I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

              P Offline
              P Offline
              Pualee
              wrote on last edited by
              #16

              It is not entirely the fault of the coders... I remember being able to find manuals accurately documenting APIs and giving examples of how to use them. Now, if I can even find the necessary documentation for something, it is just as likely to be incomplete as inaccurate. I have to rely on web searches to find code snippets where documentation does not exist.

              D 1 Reply Last reply
              0
              • J Jacquers

                I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                D Offline
                D Offline
                dandy72
                wrote on last edited by
                #17

                I'm guilty of the opposite - if I don't understand a "borrowed" solution, I'll pretty much take it apart and rebuild it until I do, so in the end, even though I have a solution that I finally understand, I often feel that I really, really, should've "just moved on" and saved myself a lot of time.

                1 Reply Last reply
                0
                • J Jacquers

                  I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                  M Offline
                  M Offline
                  Munchies_Matt
                  wrote on last edited by
                  #18

                  WTF!!!!??? Do you? Jesus Christ, that sucks. You useless lazy F*&^$*%*r

                  1 Reply Last reply
                  0
                  • P Pualee

                    It is not entirely the fault of the coders... I remember being able to find manuals accurately documenting APIs and giving examples of how to use them. Now, if I can even find the necessary documentation for something, it is just as likely to be incomplete as inaccurate. I have to rely on web searches to find code snippets where documentation does not exist.

                    D Offline
                    D Offline
                    Derek Hunter
                    wrote on last edited by
                    #19

                    I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.

                    N 1 Reply Last reply
                    0
                    • J Jacquers

                      I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                      S Offline
                      S Offline
                      sir_download_alot
                      wrote on last edited by
                      #20

                      Yes, mankind hasn't developed because everybody invented their own version of the wheel. We have developed because we are capable of putting things together to create new things. I copy and get inspiration from other code a lot, otherwise I wouldn't be able to keep my deadlines. I do review and try to understand the code that I copy. Sometimes I need to alter it for my specific purposes but it already saves me a ton of time not having to read all the documentation. On the other hand I'm also putting my solutions out there for others to use.

                      1 Reply Last reply
                      0
                      • J Jacquers

                        I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                        A Offline
                        A Offline
                        Asday
                        wrote on last edited by
                        #21

                        I would never dare do that. If my name is on the blame, then I _have_ to understand it. If I don't, then I don't deserve my job. If I want someone else's name to be on it, they have to have released it as a library.

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          I know what you mean, and that just makes it even weirder - since it seems to be a "yoof thing" and they grew up in a much more "no-wrong answers" education system than we did. Or at least I did - there was one right answer and you were supposed to know it rather than work it out for yourself in pretty much all subjects.

                          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                          P Offline
                          P Offline
                          Peter Shaw
                          wrote on last edited by
                          #22

                          The absolute plethora of "What is the exact/right way to do this thing" questions on here, or everywhere else for that matter is perfect evidence of this. I call it the "One Solution to Rule them All" approach, most others call it only knowing how to use a hammer. Even more so, I laugh at the abundance of "Exam Cheat Sheets" you can easily find online now too, just go download one, memorize the thing, then pass with flying colors the next day, none of this "OH SHIT My final exam is due tomorrow, last minute studying and panic anymore :-)", I passed my UNI course back in the day... just. or so I'm told. :-)

                          STILL CRAZY - The BEST and only way to be!

                          1 Reply Last reply
                          0
                          • D Derek Hunter

                            I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.

                            N Offline
                            N Offline
                            Navanax
                            wrote on last edited by
                            #23

                            I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.

                            :doh:

                            C 1 Reply Last reply
                            0
                            • J Jacquers

                              I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                              K Offline
                              K Offline
                              KC CahabaGBA
                              wrote on last edited by
                              #24

                              It is one thing to copy and drop code into our apps without regard to the entire scope of it's functionality. Quite another to take another's demonstration of how to do something in code and learn from it to develop your own rendition of the process and thereby considering the full ramifications of what your needing to do, verses what the reference source does. One is simply shortcutting yourself, the other is enhancing the scope of your abilities.

                              D 1 Reply Last reply
                              0
                              • OriginalGriffO OriginalGriff

                                I will use a "developed control" without looking too hard (or even at all :-O ) at the source code, provided it's from a source that I trust. But I won't copy'n'paste code - even small snippets - without understanding how it does what it does. If I don't, then I'm in the position of "then a miracle occurs" and I can't fix it in response to changes, or do it again next time something similar occurs. I do not understand the "grab random code from the internet and hope it works" mentality - it just seems counterproductive in the long term to me. I don't think it does "speed up development" - it gets you out of a hole right now, but drops you in a bigger one later on!

                                Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                                J Offline
                                J Offline
                                Jim_Snyder
                                wrote on last edited by
                                #25

                                I do the same. If I understand the code, I type in a subset of the online version without all the dead code padding that invariably will be there. As an example, in Winforms when opening a connection, most code wraps the implicit SqlDataAdapter.Fill with explicit conn.Open and conn.Closed. I am fine with just the implicit. Of course, I also document my code, transfer Class information to Word documents for easy re-accessing, and test the bejabbers out of it.

                                1 Reply Last reply
                                0
                                • K KC CahabaGBA

                                  It is one thing to copy and drop code into our apps without regard to the entire scope of it's functionality. Quite another to take another's demonstration of how to do something in code and learn from it to develop your own rendition of the process and thereby considering the full ramifications of what your needing to do, verses what the reference source does. One is simply shortcutting yourself, the other is enhancing the scope of your abilities.

                                  D Offline
                                  D Offline
                                  dandy72
                                  wrote on last edited by
                                  #26

                                  KC@CahabaGBA wrote:

                                  enhancing the scope of your abilities.

                                  I'm writing this one down. :-)

                                  1 Reply Last reply
                                  0
                                  • J Jacquers

                                    I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                                    R Offline
                                    R Offline
                                    RedDk
                                    wrote on last edited by
                                    #27

                                    Late add of my sense to this topic because it is a good one. There's got to be rules to scavenging, as it were, and first and foremost is that one always retains the address of the snippet used in a comment somewhere. Presumeably your code is now working, right? Any code I use also will have an interface tool companion through which that code is fully accessible in a find/search model of discovery. The bottom line on the "rule" then is you better be able to account for any functional upside moving forward.

                                    1 Reply Last reply
                                    0
                                    • N Navanax

                                      I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.

                                      :doh:

                                      C Offline
                                      C Offline
                                      Craig Pelkie
                                      wrote on last edited by
                                      #28

                                      If I copy-paste more than a few lines of code, based on an example I found on a web page (usually CP or StackOverflow), I put the complete URL to the page as a comment in the method header. That way, I can quickly go back to the original source and review the "documentation", such as it is.

                                      1 Reply Last reply
                                      0
                                      • J Jacquers

                                        I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                                        J Offline
                                        J Offline
                                        jediYL
                                        wrote on last edited by
                                        #29

                                        You're probably supposed to read through the code once after you paste it. Never read it anywhere though :^)

                                        Remain Calm & Continue To Google

                                        1 Reply Last reply
                                        0
                                        • J Jacquers

                                          I have to admit that I'm guilty of this... I need to solve a problem, so I Google, find a working solution and paste it into my code. It works, but you don't necessarily understand the solution. On the one hand having answers so easily available speeds up development, but on the other it makes for developers that don't really understand what they are doing?

                                          M Offline
                                          M Offline
                                          MSBassSinger
                                          wrote on last edited by
                                          #30

                                          It is good engineering to not reinvent the wheel. Finding out how others solved the same problem is common in science with peer reviews of findings. When I search, I look at multiple posts, make sure I understand them, then derive my own value-added code from what I have learned. "Copy and paste" generally makes for buggy code. For the experienced developer, searching Google or Bing for code that solves a problem is not a "copy and paste" process, but an accelerated process of learning and applying what was learned to one's own code. A developer that does not look at how other developers approach a given problem is not one I would hire. They will not learn as well, are likely too prideful, and produce mostly mediocre work.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups