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. Other Discussions
  3. The Weird and The Wonderful
  4. Copy and Paste should be banned from a code editor

Copy and Paste should be banned from a code editor

Scheduled Pinned Locked Moved The Weird and The Wonderful
comxmlfunctionalquestion
18 Posts 10 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.
  • L Lost User

    Lovely horrendous code. Even a stringbuilder would not be an improvement, it would merely be some paint over a house that is nearly collapsing.

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #9

    Mopping with the crane open! :D

    It's an OO world.

    public class SanderRossel : Lazy<Person>
    {
    public void DoWork()
    {
    throw new NotSupportedException();
    }
    }

    My blog[^]

    1 Reply Last reply
    0
    • RaviBeeR RaviBee

      Marc Clifton wrote:

      there must be something we can put into the water

      There is.  Code reviews. :) /ravi

      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #10

      Ravi Bhavnani wrote:

      There is.  Code reviews.

      How do you figure out that the guy you hired is creating crap, especially if you're a small outfit and you only have one dev, and it's this guy? Do you hire another consultant to do the code reviews? BTW, here's is bio: With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years. The last five years have been spent on developing mobile apps for iPhone, iPad, Android and Windows Phone and Windows 8 environments. Mr. ... skills also include being a MS SQL Server DBA as well as a web developer.. Now that's scary. Marc

      Imperative to Functional Programming Succinctly Higher Order Programming

      RaviBeeR M 2 Replies Last reply
      0
      • M Marc Clifton

        This code (sanitized):

        static public void PostSomeCodeMethod(string v1, string v2, string v3)
        {
        string xmldata = iRecord.CreateField("apicode", APICodes.SomeCode.ToString());
        xmldata += iRecord.CreateField("f1", const1);
        xmldata += iRecord.CreateField("f2", const2);
        xmldata += iRecord.CreateField("f3", v1);
        xmldata += iRecord.CreateField("f4", v2);
        xmldata += iRecord.CreateField("f5", v3);

            ErrorMessage = null;
            CallPostAPI(xmldata);
        

        Is duplicated a dozen times. The only difference? The method name and the APICodes enumeration. I swear, copy and paste should be banned, and there must be something we can put into the water that prevents programmers like this from ever writing another line of code. (Not to mention the horrific way the XML data is created. Happy belated Halloween, everyone.) Marc

        Imperative to Functional Programming Succinctly Higher Order Programming

        I Offline
        I Offline
        Ian Shlasko
        wrote on last edited by
        #11

        I disagree. Copy-paste makes for highly-efficient coding. Not only do you get a perfect duplicate of a line, but the efficiency increases exponentially with the number of copies! Think about it... First you copy-paste one line, then you copy-paste those two lines, then four... You could be copying thousands of lines after only a dozen pastes! And think about it... Unlike all of those silly objects and functions, you can change just one of those thousand copies without having to mess with all of the rest! It's so much better that way. So everyone needs to copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more.... (Chris needs to add a <sarcasm> tag to the forums, cause I know someone is going to take the above literally... Well, not now, because they'll read this message... Unless it's too small... Here, let me make it smaller.....)

        Proud to have finally moved to the A-Ark. Which one are you in?
        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

        M 1 Reply Last reply
        0
        • I Ian Shlasko

          I disagree. Copy-paste makes for highly-efficient coding. Not only do you get a perfect duplicate of a line, but the efficiency increases exponentially with the number of copies! Think about it... First you copy-paste one line, then you copy-paste those two lines, then four... You could be copying thousands of lines after only a dozen pastes! And think about it... Unlike all of those silly objects and functions, you can change just one of those thousand copies without having to mess with all of the rest! It's so much better that way. So everyone needs to copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more.... (Chris needs to add a <sarcasm> tag to the forums, cause I know someone is going to take the above literally... Well, not now, because they'll read this message... Unless it's too small... Here, let me make it smaller.....)

          Proud to have finally moved to the A-Ark. Which one are you in?
          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #12

          Ian Shlasko wrote:

          you can change just one of those thousand copies without having to mess with all of the rest! It's so much better that way.

          Or use it's evil twin, search and replace to easily change everything everywhere with the click of a mouse button! You've changed my thinking, Ian! I shall strive to become a copy-paste-replace developer! Marc

          Imperative to Functional Programming Succinctly Higher Order Programming

          1 Reply Last reply
          0
          • M Marc Clifton

            This code (sanitized):

            static public void PostSomeCodeMethod(string v1, string v2, string v3)
            {
            string xmldata = iRecord.CreateField("apicode", APICodes.SomeCode.ToString());
            xmldata += iRecord.CreateField("f1", const1);
            xmldata += iRecord.CreateField("f2", const2);
            xmldata += iRecord.CreateField("f3", v1);
            xmldata += iRecord.CreateField("f4", v2);
            xmldata += iRecord.CreateField("f5", v3);

                ErrorMessage = null;
                CallPostAPI(xmldata);
            

            Is duplicated a dozen times. The only difference? The method name and the APICodes enumeration. I swear, copy and paste should be banned, and there must be something we can put into the water that prevents programmers like this from ever writing another line of code. (Not to mention the horrific way the XML data is created. Happy belated Halloween, everyone.) Marc

            Imperative to Functional Programming Succinctly Higher Order Programming

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #13

            Copy is OK; it's paste that causes the trouble.

            1 Reply Last reply
            0
            • M Marc Clifton

              Ravi Bhavnani wrote:

              There is.  Code reviews.

              How do you figure out that the guy you hired is creating crap, especially if you're a small outfit and you only have one dev, and it's this guy? Do you hire another consultant to do the code reviews? BTW, here's is bio: With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years. The last five years have been spent on developing mobile apps for iPhone, iPad, Android and Windows Phone and Windows 8 environments. Mr. ... skills also include being a MS SQL Server DBA as well as a web developer.. Now that's scary. Marc

              Imperative to Functional Programming Succinctly Higher Order Programming

              RaviBeeR Offline
              RaviBeeR Offline
              RaviBee
              wrote on last edited by
              #14

              Marc Clifton wrote:

              How do you figure out that the guy you hired is creating crap,

              I don't see any way other than formal/informal code inspections.  The sooner they're done, the easier they are to fix.  Eyeballing check-ins at the end of the day may be a valuable yet lightweight approach.  If there's no cause for alarm, further reviews may be unnecessary, or at least not frequently required. You don't want to find yourself in a situation (as I expect you may be in) where several weeks of check-ins are of poor quality. :( /ravi

              My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

              1 Reply Last reply
              0
              • M Marc Clifton

                Ravi Bhavnani wrote:

                There is.  Code reviews.

                How do you figure out that the guy you hired is creating crap, especially if you're a small outfit and you only have one dev, and it's this guy? Do you hire another consultant to do the code reviews? BTW, here's is bio: With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years. The last five years have been spent on developing mobile apps for iPhone, iPad, Android and Windows Phone and Windows 8 environments. Mr. ... skills also include being a MS SQL Server DBA as well as a web developer.. Now that's scary. Marc

                Imperative to Functional Programming Succinctly Higher Order Programming

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

                Marc Clifton wrote:

                With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years

                That's like saying "with qualifications in refrigerator and microwave oven design, Mr. ... has been creating recipes for over 20 years". The qualifications have little to do with the work he's doing.

                I wanna be a eunuchs developer! Pass me a bread knife!

                1 Reply Last reply
                0
                • M Marc Clifton

                  This code (sanitized):

                  static public void PostSomeCodeMethod(string v1, string v2, string v3)
                  {
                  string xmldata = iRecord.CreateField("apicode", APICodes.SomeCode.ToString());
                  xmldata += iRecord.CreateField("f1", const1);
                  xmldata += iRecord.CreateField("f2", const2);
                  xmldata += iRecord.CreateField("f3", v1);
                  xmldata += iRecord.CreateField("f4", v2);
                  xmldata += iRecord.CreateField("f5", v3);

                      ErrorMessage = null;
                      CallPostAPI(xmldata);
                  

                  Is duplicated a dozen times. The only difference? The method name and the APICodes enumeration. I swear, copy and paste should be banned, and there must be something we can put into the water that prevents programmers like this from ever writing another line of code. (Not to mention the horrific way the XML data is created. Happy belated Halloween, everyone.) Marc

                  Imperative to Functional Programming Succinctly Higher Order Programming

                  M Offline
                  M Offline
                  Mark_Wallace
                  wrote on last edited by
                  #16

                  If he was being paid by number of lines of code, I congratulate him. I'd probably do the same.

                  I wanna be a eunuchs developer! Pass me a bread knife!

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    This code (sanitized):

                    static public void PostSomeCodeMethod(string v1, string v2, string v3)
                    {
                    string xmldata = iRecord.CreateField("apicode", APICodes.SomeCode.ToString());
                    xmldata += iRecord.CreateField("f1", const1);
                    xmldata += iRecord.CreateField("f2", const2);
                    xmldata += iRecord.CreateField("f3", v1);
                    xmldata += iRecord.CreateField("f4", v2);
                    xmldata += iRecord.CreateField("f5", v3);

                        ErrorMessage = null;
                        CallPostAPI(xmldata);
                    

                    Is duplicated a dozen times. The only difference? The method name and the APICodes enumeration. I swear, copy and paste should be banned, and there must be something we can put into the water that prevents programmers like this from ever writing another line of code. (Not to mention the horrific way the XML data is created. Happy belated Halloween, everyone.) Marc

                    Imperative to Functional Programming Succinctly Higher Order Programming

                    P Offline
                    P Offline
                    Plamen Dragiyski
                    wrote on last edited by
                    #17

                    C&P is so called static modelling, where programmer runs the program (not the computer), evaluate the exit and then write exactly what he done in his head in code, so computer can repeat it. Ironic thing is that computer is made for automation and actually it is his job to do the repetitive stuff while human neural network (called brain) is very good in finding and giving short description of repetitive stuffs. So apparently some brains are better than others.

                    1 Reply Last reply
                    0
                    • RaviBeeR RaviBee

                      Marc Clifton wrote:

                      there must be something we can put into the water

                      There is.  Code reviews. :) /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      F Offline
                      F Offline
                      Freak30
                      wrote on last edited by
                      #18

                      Ravi Bhavnani wrote:

                      Marc Clifton wrote:

                      there must be something we can put into the water

                      There is.  Code reviews.

                      Well, we could put the offending developer into the water ... head-first. That would solve the issue.

                      The good thing about pessimism is, that you are always either right or pleasently surprised.

                      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