Copy and Paste is the work of the devil
-
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)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 :).
-
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)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
-
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
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) -
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)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
-
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
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
-
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)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
-
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
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
-
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)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
-
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)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
-
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
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
-
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
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) -
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)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
-
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) -
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)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.
-
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
That is my preferred method, as well. :-D
Just think of it as evolution in action.
-
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
-
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)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
-
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)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.)
-
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)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'.