Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by thorsten müller, gnat, Bart van Ingen Schenau, MichaelT, JeffO Apr 16 '13 at 14:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Point this person to Why is “copy and paste” of code dangerous? –  Oded Apr 16 '13 at 13:01
    
@Oded, +1 to your comment. Nice resource. I will point this resource to him. –  Md. Mahbubur R. Aaman Apr 16 '13 at 13:03
4  
Almost always the answer to these "inept colleague" questions is global Code Review. –  glenatron Apr 16 '13 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. –  Doc Brown Apr 16 '13 at 13:26
6  
am I the only one who finds it ironic that this got closed for being a dupe? –  ratchet freak Apr 16 '13 at 15:39

1 Answer 1

up vote 8 down vote accepted

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?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.