Why developers copy paste ?

A conspiracy theory !

First and foremost, i don't think coding complex requirements or components implies copy and paste.

But in my experience what happens is the following:

Let's say me and a friend are dev founders for a new startup and after a big effort we build our application using an exuberant new programming language and database. So we are happy and we have our codebase looking like this:

image.png

So after 2 years we have a team of 15 developers with different roles and skills. Code is improved and new modules are created. Customers are happy(kind of). But also we have a developer with a different mindset and thinks that MVC is no longer standard and he loves functional coding more. So as the company loves diversity of thought approach is approved and even the rebel developer does a demo for the team.

Now we have our codebase looking like this:

image.png

Now 5 years have passed our codebase is very big but our lovely monolith works fine. And vertical scaling works for now.

So more requirements are needed and some refactors are done. Even functional programming is used sometimes. What happens to our code base ? So we can assume as we are in modern times and MVC no longer is popular. Codebase must be different ? right ?

So codebase now looks like this:

image.png

What happened ? Do we have developers without creativity ?

I think answer is simple:

image.png

Good meme but not the answer for the original question.

My theories are:

  • Developers assume that legacy code is good and sacred. And must never be touched !.
  • Developers assume that legacy code is the standard way to do coding.

And if you would like a simple reason:

Developers are just lazy and quickly bored. And most important they love patterns/heuristics for doing things.

So if a pattern or way to do things work; they will use it until the end of their developer's life. They love caching techniques in their brains.

EOF