Tuesday, 21 May 2013

How to avoid code duplication across unrelated projects

How to avoid code duplication across unrelated projects

I'm a contractor at a large Telco where I'm usually working on several different projects at once.
The VCSs I use (mainly git and mercurial) tend to make me keep the code bases for unrelated projects in separate repositories, and I realise many benefits of this approach.
However, there are many little bits of utility code and helper functions I've written which are useful across two or more projects, and I'm well aware of the benefits of keeping my code DRY - for example sometimes I find a better way to implement some piece of code and I don't want to have to update it in every place where I've duplicated the same idea.
What is the best way to refactor out this common functionality (it is not always so simple as copy-and-paste, but sometimes it is..) without creating unnecessary dependencies between unrelated projects, and without adding needless complexity?

No comments:

Post a Comment