Friends Don’t Let Friends Copy and Paste

Blog Summary: (AI Summaries by Summarizes)
  • A junior programmer wrote some code with copy/paste code that was unmanageable and led to bugs.
  • Refactoring the code by creating a new class led to half the code to maintain and a class that could be used again.
  • A programmer for a large company in Reno spends most of his time looking for copy and pasted code to refactor into a library.
  • Copying and pasting code should be avoided as it can lead to unmanageable code and bugs. Instead, code should be refactored into a common class or library.

I ran into this comment in some code and just had to laugh (and refactor it).

/**
* Note: The code has some copy/paste code. Because it can't integrate to a method.
* The parameter painter can't be changed when drawing.
*       If it newly twice when drawing, the text may not be shown.
*/

The code was written by a very, very junior programmer.  It turns out that he was wrong about being unable to refactor it.  He just needed to create a new class.  The code that he wrote was unmanageable and led to bugs.  When fixing an issue on one side, you had to remember to fix it on the other side.  Refactoring it led to half the code to maintain and a class that could be used again.

I talked to programmer for a large company in Reno who spent most of his time looking for copy and pasted code.  It was his job to refactor it into a library.

So please for my sanity’s sake, don’t copy and paste code on the off chance I have to work on it.  If you feel the need to copy and paste, chances are it should be in a common class or a library somewhere.

Related Posts

The Data Discovery Team

Blog Summary: (AI Summaries by Summarizes) The concept of a “data discovery team” is introduced, which focuses on searching for data in an enterprise data

Black and white photo of three corporate people discussing with a view of the city's buildings

Current 2023 Announcements

Blog Summary: (AI Summaries by Summarizes) Confluent’s Current Conference featured several announcements that are important for both technologists and investors. Confluent has two existing moats

zoomed in line graph photo

Data Teams Survey 2023 Follow-Up

Blog Summary: (AI Summaries by Summarizes) Many companies, regardless of size, are using data mesh as a methodology. Smaller companies may not necessarily need a

Laptop on a table showing a graph of data

Data Teams Survey 2023 Results

Blog Summary: (AI Summaries by Summarizes) A survey was conducted between January 24, 2023, and February 28, 2023, to gather data for the book “Data

Black and white photo of three corporate people discussing with a view of the city's buildings

Analysis of Confluent Buying Immerok

Blog Summary: (AI Summaries by Summarizes) Confluent has announced the acquisition of Immerok, which represents a significant shift in strategy for Confluent. The future of

Tall modern buildings with the view of the ocean's horizon

Brief History of Data Engineering

Blog Summary: (AI Summaries by Summarizes) Google created MapReduce and GFS in 2004 for scalable systems. Apache Hadoop was created in 2005 by Doug Cutting