Copy & Paste Based Development

This is about Mr., W. J. a nice and friendly developer working for an IT company in a cosmopolitan city. He was in charge of five other developers. I was one of them.

It was probably my second day in the company, and he assigned a programming task to me. I was working on it, trying to figure out what the heck was that software I was going to help maintaining for the next months all about. Then, Mr. W. J. wanted to borrow my brain for a second. I wasn't using it, so I lent it. "Do you think this is a good implementation?" Mr. W. J. puzzled asked while looking at the screen, then to my face, back to the screen, then to the infinite. "Ummm... I'd say..." I managed to merely bubble when he interrupted. "I think I can also do this..." he said and immediately started to select a whole class with a hundred lines of code or more. He copied the code. He pasted the code. He pasted it in an empty file, slightly changed the name of the class, and made some modifications in a couple of lines. He ran the application, tested something on the screen, and said "thanks" without any traces of irony.

I couldn't resist my curiosity. "So... are you committing that code?" I puzzled asked while looking at the screen, then to his face​, back to the screen... "Yes!" he quickly replied without giving me the chance to look to the infinite. I thought it would be a Good Thing™ to explain him that Copy & Paste Driven Development™ is a Bad Thing™ sometimes. Explaining to a junior developer why that technique should be avoided is not the same as explaining it to your manager*, so I decided to tell Mr. W. J. a story about copy & paste in software development.

"It's funny," I started saying. "Some years ago I was working in a company and did something like what you did," I continued. "I copied a big portion of code, pasted it somewhere else and made a small adjustment," I added. "I didn't realise my boss was there when he poked me in my shoulder and said «don't do that again»," I convincingly finalised**. "Why did he say that?" Mr. W. J. puzzled asked while looking at the screen, then to my face, back to the screen. "I don't know..." I defeatedly replied while looking at the screen, then to his face, back to the screen, then to the infinite...

* It highly depends on the manager and the junior developer in question.

** I switched roles while telling this short story to be more empathetic with Mr. W. J. Did you think I was a copy-paste maniac? I think Mr. W. J. was. I saw him copying and pasting identifiers that were 2 or 3 characters long sometimes.

Comments

Popular posts from this blog

Infinite lazy loading

Hello, World in Vaadin 10+

Semantic coupling