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 and Paste is the work of the devil

Copy and Paste is the work of the devil

Scheduled Pinned Locked Moved The Lounge
27 Posts 18 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.
  • S Slacker007

    Henry Minute wrote:

    If you are having to copy/paste your own code it should be in it's own class already.

    Not always, Henry.

    Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
    "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

    S Offline
    S Offline
    SledgeHammer01
    wrote on last edited by
    #9

    I think pretty much always. If you are programming via c&p, you need to re-think your design. For example, in my app, I have 13 "scripts". I stupidly named them in the original design ScriptThatDoesThis, ScriptThatDoesThat, etc. So I have a lot of logic that is c&p'ed because the names of the scripts are different. I could either leave it like that and refactor the common code as a method, or a better design would have been to have an array of Script[13] and have an enum as the key or something like that. Oh well, too late now :).

    1 Reply Last reply
    0
    • S Slacker007

      It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

      Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
      "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #10

      I avoid copy/paste by using cut/paste/paste. I basically paste back the original contents and then paste again to make the duplicate. This way I never have to Ctrl-C, it's always Ctrl-X for me. :-D

      Regards, Nish


      My technology blog: voidnish.wordpress.com You've gotta read this : Using lambdas - C++ vs. C# vs. C++/CX vs. C++/CLI

      S C S 3 Replies Last reply
      0
      • N Nish Nishant

        I avoid copy/paste by using cut/paste/paste. I basically paste back the original contents and then paste again to make the duplicate. This way I never have to Ctrl-C, it's always Ctrl-X for me. :-D

        Regards, Nish


        My technology blog: voidnish.wordpress.com You've gotta read this : Using lambdas - C++ vs. C# vs. C++/CX vs. C++/CLI

        S Offline
        S Offline
        Slacker007
        wrote on last edited by
        #11

        Ah, the voice of reason and experience. :)

        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

        1 Reply Last reply
        0
        • S Slacker007

          Henry Minute wrote:

          If you are having to copy/paste your own code it should be in it's own class already.

          Not always, Henry.

          Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
          "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

          C Offline
          C Offline
          clientSurfer
          wrote on last edited by
          #12

          Quote:

          Not always, Henry.

          Well if you're already too lazy to rewrite said code from scratch everytime, I would take a gander that you're probably way too lazy to go through the OO creative exercise with it :-D

          "... having only that moment finished a vigorous game of Wiff-Waff and eaten a tartiflet." - Henry Minute  "...who gives a tinker's cuss?" - Dalek Dave  "Let's face it, after Monday and Tuesday, even the calendar says WTF!" - gavindon   It's plain that they do not yet know what true fear really is. - JSOP 2011

          1 Reply Last reply
          0
          • N Nish Nishant

            I avoid copy/paste by using cut/paste/paste. I basically paste back the original contents and then paste again to make the duplicate. This way I never have to Ctrl-C, it's always Ctrl-X for me. :-D

            Regards, Nish


            My technology blog: voidnish.wordpress.com You've gotta read this : Using lambdas - C++ vs. C# vs. C++/CX vs. C++/CLI

            C Offline
            C Offline
            clientSurfer
            wrote on last edited by
            #13

            ya but what we really all want to know (honestly now) is how many times you've been in such a hurry that you forgot that second Ctrl-X until it was too late :laugh:

            "... having only that moment finished a vigorous game of Wiff-Waff and eaten a tartiflet." - Henry Minute  "...who gives a tinker's cuss?" - Dalek Dave  "Let's face it, after Monday and Tuesday, even the calendar says WTF!" - gavindon   It's plain that they do not yet know what true fear really is. - JSOP 2011

            1 Reply Last reply
            0
            • S Slacker007

              It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

              Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
              "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

              J Offline
              J Offline
              Jorgen Andersson
              wrote on last edited by
              #14

              Well, you know the old saying: You can have it done fast. You can have it done cheap. You can have it done right. Choose two. Copy & paste is fast and cheap. Guess what most companies want. Yep, all three.

              Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

              C 1 Reply Last reply
              0
              • J Jorgen Andersson

                Well, you know the old saying: You can have it done fast. You can have it done cheap. You can have it done right. Choose two. Copy & paste is fast and cheap. Guess what most companies want. Yep, all three.

                Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                C Offline
                C Offline
                clientSurfer
                wrote on last edited by
                #15

                Picasso had a saying: Good artists borrow, great artists steal I guess this could apply to stealing from yourself, hmm never really thought about that before.... :~

                "... having only that moment finished a vigorous game of Wiff-Waff and eaten a tartiflet." - Henry Minute  "...who gives a tinker's cuss?" - Dalek Dave  "Let's face it, after Monday and Tuesday, even the calendar says WTF!" - gavindon   It's plain that they do not yet know what true fear really is. - JSOP 2011

                B 1 Reply Last reply
                0
                • S Slacker007

                  It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                  Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                  "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                  E Offline
                  E Offline
                  Ennis Ray Lynch Jr
                  wrote on last edited by
                  #16

                  I am personally tired of copy and paste not working, correctly. Lets say I am in one application so I highlight with the mouse, press control+C, Alt+Tabl, control+V 99% of the time it doesn't work. I have to manually use the copy and past commands from the context menu. So annoying.

                  Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                  1 Reply Last reply
                  0
                  • S Slacker007

                    It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                    Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                    "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                    M Offline
                    M Offline
                    Mycroft Holmes
                    wrote on last edited by
                    #17

                    Snippets are todays copy and paste. Bloody excellent, I have replaced my viewmodel boilerplate with 3 snippets.

                    Never underestimate the power of human stupidity RAH

                    S 1 Reply Last reply
                    0
                    • C clientSurfer

                      Picasso had a saying: Good artists borrow, great artists steal I guess this could apply to stealing from yourself, hmm never really thought about that before.... :~

                      "... having only that moment finished a vigorous game of Wiff-Waff and eaten a tartiflet." - Henry Minute  "...who gives a tinker's cuss?" - Dalek Dave  "Let's face it, after Monday and Tuesday, even the calendar says WTF!" - gavindon   It's plain that they do not yet know what true fear really is. - JSOP 2011

                      B Offline
                      B Offline
                      Brisingr Aerowing
                      wrote on last edited by
                      #18

                      clientSurfer wrote:

                      I guess this could apply to stealing from yoursel

                      Interesting thought there. A lot of students at Purdue (in the CS department) do that with homework and projects (I didn't, due to the fact it took them longer to finish with copy, paste, fix some code, repeat, than it took the people who wrote the code from scratch). :cool:

                      Public Sub GetOffTheComputer() Throw New NotImplementedException() End Sub

                      1 Reply Last reply
                      0
                      • M Mycroft Holmes

                        Snippets are todays copy and paste. Bloody excellent, I have replaced my viewmodel boilerplate with 3 snippets.

                        Never underestimate the power of human stupidity RAH

                        S Offline
                        S Offline
                        Slacker007
                        wrote on last edited by
                        #19

                        Exactly. I had copied one line from a snippet and forgot to change it up. Big deal. It seems that a lot of people here on this site, hop on certain band wagons, not knowing what the hell they are really doing. You look at their profiles and they are supposedly "senior" devs and the only thing then that come to my mind is :omg: :wtf:. and I'm supposed to take their advice? No way, Jose. -- cheers.

                        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                        1 Reply Last reply
                        0
                        • S Slacker007

                          It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                          Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                          "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                          F Offline
                          F Offline
                          Fabio Franco
                          wrote on last edited by
                          #20

                          I completely agree with you, whenever I find myself using Copy and Paste I refactor my code.

                          "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                          1 Reply Last reply
                          0
                          • S Slacker007

                            It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                            Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                            "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                            K Offline
                            K Offline
                            kmoorevs
                            wrote on last edited by
                            #21

                            Ctrl, X, C, V...the most popular keys on my keyboard! I usually keep on or two Notepad windows available for scratch areas or to remove formatting.

                            "Go forth into the source" - Neal Morse

                            E 1 Reply Last reply
                            0
                            • S Slacker007

                              It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                              Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                              "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                              C Offline
                              C Offline
                              crazedDotNetDev
                              wrote on last edited by
                              #22

                              Then call me a heretic. Copy/paste isn't so bad if you pay attention. I keep a few snippets/scripts at the ready. They tend to be special cases that don't lend themselves well to the "Correct Way"™... and (by design) they never compile. That keeps me from being stupid once the caffeine runs low.

                              1 Reply Last reply
                              0
                              • N Nish Nishant

                                I avoid copy/paste by using cut/paste/paste. I basically paste back the original contents and then paste again to make the duplicate. This way I never have to Ctrl-C, it's always Ctrl-X for me. :-D

                                Regards, Nish


                                My technology blog: voidnish.wordpress.com You've gotta read this : Using lambdas - C++ vs. C# vs. C++/CX vs. C++/CLI

                                S Offline
                                S Offline
                                Steve Burchett
                                wrote on last edited by
                                #23

                                That is my preferred method, as well. :-D

                                Just think of it as evolution in action.

                                1 Reply Last reply
                                0
                                • K kmoorevs

                                  Ctrl, X, C, V...the most popular keys on my keyboard! I usually keep on or two Notepad windows available for scratch areas or to remove formatting.

                                  "Go forth into the source" - Neal Morse

                                  E Offline
                                  E Offline
                                  eveshanm
                                  wrote on last edited by
                                  #24

                                  Mine to. I even bought a mouse with 2 extra buttons which are assigned to copy & paste.

                                  1 Reply Last reply
                                  0
                                  • S Slacker007

                                    It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                                    Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                                    "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                                    M Offline
                                    M Offline
                                    Marc Greiner at home
                                    wrote on last edited by
                                    #25

                                    There is a new awesome CodeRush functionality that can scan your code (C# or VB.NET) in the background for duplicated code and offers to consolidate it : http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/duplicate_code.xml http://community.devexpress.com/blogs/markmiller/archive/2011/11/29/duplicate-detection-and-consolidation-in-coderush-for-visual-studio.aspx

                                    1 Reply Last reply
                                    0
                                    • S Slacker007

                                      It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                                      Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                                      "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                                      J Offline
                                      J Offline
                                      jschell
                                      wrote on last edited by
                                      #26

                                      Slacker007 wrote:

                                      It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you.

                                      Depends on the context. Reuse via the library idiom requires planning, requirements, dependency resolution and education. The last by itself can often preclude usage both in small and larger enterprises. Even a simple class usage can be complicated by differing requirements. I would much rather see similar code in two places versus code in one place with is complicated by a number of conditionals in that code base which exist solely to deal with requirements for different usage (which is something that I have seen.) That latter alternative can lead to very fragile code. I continue to see well intentioned code created as real libraries based on a single usage which has no better chance of succeeding than implementing a base class based on a single child class. People can't even understand usage requirements for libraries that are used in multiple places as they will attempt to push application specific functionality into such libraries because it is related (or even just convenient.)

                                      1 Reply Last reply
                                      0
                                      • S Slacker007

                                        It is even more devilish if you copy and paste your own code. It's down right perverted, I tell you. :sigh:

                                        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                                        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)

                                        S Offline
                                        S Offline
                                        Stefan_Lang
                                        wrote on last edited by
                                        #27

                                        I mostly use it for copying long variable names, but even that is rarely necessary thanks to great tools like VisualAssist. When copying entire lines of code it's usually no more than 1-2 lines, i. e. not enough to trouble myself with extracting a separate function. I do see the effects of 'evil' copying code though: parts of our application date back to the times of the structured programming paradigm, and there are lots of functions that are 95% identical to others, and it is a real pain when I need to change something within one of those, because it's often hard to locate the 'evil twins'.

                                        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