2

One of our team member duplicates code. Code duplication causes confusion among my team members reading his code, it causes bugs down the line when the duplicated segment is fixed in one location and not the others and it bloats the size of his code-base.

I have discussed with him not to duplicate code. But he show excuses that it will delay our projects deadline if he refactors all the places where he made code duplication.

How better can I deal with him?

1 Answers1

8

You can explain that it would be more costly in delays to fix the same bug in 5 locations.

And then finding out that the fix was missed in location 6.

It also delays the team when they look at a piece of code, expecting it be be called from one location, but it never does, as it is duplicated elsewhere, where it is being called.

This is particularly problematic when certain versions of the duplication change slightly - it is then difficult to tell which one is the "right" one and why - this is one of the most difficult things to correct and is very time consuming.

You can also send them to Why is “copy and paste” of code dangerous?

Oded
  • 53,586
  • 19
  • 167
  • 181