views:

56

answers:

1

Before I begin, similar questions but not exact:
http://stackoverflow.com/questions/41405/working-with-common-utility-libraries,
http://stackoverflow.com/questions/407739/what-to-include-in-a-utility-library.

I have recently starting working with our company's internal C# libraries, which include Common.dll and Utilities.dll; pretty standard stuff.

My current plan is to refine these two libraries into two very separate entities, that have very separate usages. However, I haven't figured out where to draw that line.

Rather than give details on what each contains, I would like neutral advice on what you would throw into each of these, in that, how you would define that barrier. I do not need uberspecifics.

There is also the argument that these two should be consolidated into a single library. (see above links) I am open to that idea if there is no suitable alternative. I am more interested in the difference between the two though.

Thanks in advance!

+2  A: 

You speak as though "Common" and "Utility" have well understood meanings. I don't recognise that there should be such a separation, or if do some organisation of reusable code that there should be two such categories.

First I would distinguish between a body of code that tends to get reused in production applications and a a body of code that might only be used for testing.

Then to focus on production applications I would expect there to be Business Domain common code (for example code to deal with Foreign Exchange, or Car Hire Mileage Rates, or whatever your business happens to be.) and more general purpose utilities such as Logging, or String Formatting, or Some Clever Math). I think you'll find pieces of code that in some way "belong together" and some you want to keep separate. Some possible criteria:

  • Rate of change: when this changes, that probably changes too, so we need to release them together
  • Overhead - this chunk is big, only apps that need should pay the price of including or deploying it.
  • Scope - this is UI code, that is database code, keep them separately
  • Dependency - if you use this, then you also use that, so keep theOther separate, he doesn't need that
  • Avoid cyclic dependencies, decompose and recorganise to avoid those
djna
I realize it's awkward to assume that everyone's seen this distinction between the two, but it's fairly common as I peruse this and other websites.
Norla
I guess at an informal level you may be right, though clearly your question indicates that there seems to be a lack of clear definition of the dividing line. I prefer to treat the problem as one of granularity of all Reusable code. I don't think we just cut that code into two, I think it's usually more. The question is not "is this Common or is it Utility" it's "Do we have the right pieces"
djna