views:

42

answers:

2

For example, I have some project Common.Utils.csproj and use it in all other projects. I can store its (Utils) sourses in one repository, modify it only there, register dll in gac and use it as dll in other projects, or I can clone sourse anywhere I need, include project in solution, use it as source and push modifications. So, what is best practice?

+2  A: 

I would recomend having it in a single place and have your other projects reference this, so that all changes will be available, without having to update all copies.

The only problem you might face is if you change the signiture significantly, which might break the backwards compatibility, but you should try to code for that.

But this should not be a major issue if you make use of test cases for your common methods, to ensure that previously used methods are still working correctly.

astander
A: 

Avoid util libraries at all cost. They are a code smell that indicates violation of a lot of SOLID principles; first and foremost the Single Responsibility Principle.

Ayende explains it very well here.

Mark Seemann
What should I do with this class? public static class StringExtensions { public static bool IsEmpty(this string str) public static string Remove(this string str, string value) }
dotneter
I'm not saying that you can't make libraries at all, but rather you one should be very wary of common utility libraries. If you must have a class like StringExtensions, it's still better to put it in a targeted library that deals only with strings. However, such a library still begs the question of whether it really provides more value than the cost associated with maintaining it. I tend to think that it does not.
Mark Seemann