Copy-Paste Coding Culture
-
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!
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!
-
I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.
-
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?
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.
-
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!
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.
-
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.
-
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?
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.
-
I completely agree with this. I really, really miss having authoritative documentation - i.e. complete and accurate.
:doh:
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.
-
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?
-
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?
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.
-
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 had the benefit of a Navy Nuke education in the 70s when Rickover was king. If you could not, on the spot, explain the how and why of every aspect of any process in the nuclear power plant, you were not fit to serve as a nuke. We were taught to figure out the "how and why" of everything we did, and I carried that educational philosophy over into software engineering.