Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should one use a project reference opposed to a binary reference?

My company has a common code library which consists of many class libary projects along with supporting test projects. Each class library project outputs a single binary, e.g. Company.Common.Serialization.dll. Since we own the compiled, tested binaries as well as the source code, there's debate as to whether our consuming applications should use binary or project references.

Some arguments in favor of project references:

  • Project references would allow users to debug and view all solution code without the overhead of loading additional projects/solutions.
  • Project references would assist in keeping up with common component changes committed to the source control system as changes would be easily identifiable without the active solution.

Some arguments in favor of binary references:

  • Binary references would simplify solutions and make for faster solution loading times.
  • Binary references would allow developers to focus on new code rather than potentially being distracted by code which is already baked and proven stable.
  • Binary references would force us to appropriately dogfood our stuff as we would be using the common library just as those outside of our organization would be required to do.
  • Since a binary reference can't be debugged (stepped into), one would be forced to replicate and fix issues by extending the existing test projects rather than testing and fixing within the context of the consuming application alone.
  • Binary references will ensure that concurrent development on the class library project will have no impact on the consuming application as a stable version of the binary will be referenced rather than an influx version. It would be the decision of the project lead whether or not to incorporate a newer release of the component if necessary.

What is your policy/preference when it comes to using project or binary references?

like image 697
Ben Griswold Avatar asked Sep 05 '08 19:09

Ben Griswold


1 Answers

It sounds to me as though you've covered all the major points. We've had a similar discussion at work recently and we're not quite decided yet.

However, one thing we've looked into is to reference the binary files, to gain all the advantages you note, but have the binaries built by a common build system where the source code is in a common location, accessible from all developer machines (at least if they're sitting on the network at work), so that any debugging can in fact dive into library code, if necessary.

However, on the same note, we've also tagged a lot of the base classes with appropriate attributes in order to make the debugger skip them completely, because any debugging you do in your own classes (at the level you're developing) would only be vastly outsized by code from the base libraries. This way when you hit the Step Into debugging shortcut key on a library class, you resurface into the next piece of code at your current level, instead of having to wade through tons of library code.

Basically, I definitely vote up (in SO terms) your comments about keeping proven library code out of sight for the normal developer.

Also, if I load the global solution file, that contains all the projects and basically, just everything, ReSharper 4 seems to have some kind of coronary problem, as Visual Studio practically comes to a stand-still.

like image 123
Lasse V. Karlsen Avatar answered Oct 25 '22 11:10

Lasse V. Karlsen