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?

8
  • 1
    Point this person to Why is “copy and paste” of code dangerous? Commented Apr 16, 2013 at 13:01
  • @Oded, +1 to your comment. Nice resource. I will point this resource to him. Commented Apr 16, 2013 at 13:03
  • 4
    Almost always the answer to these "inept colleague" questions is global Code Review. Commented Apr 16, 2013 at 13:11
  • 2
    Changing the behaviour of a team member is never easy. Daily code reviews for a long period is the only thing which may break bad habits. Commented Apr 16, 2013 at 13:26
  • 6
    am I the only one who finds it ironic that this got closed for being a dupe? Commented Apr 16, 2013 at 15:39

1 Answer 1

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?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.