Abusing the word "library"

Posted by William Pursell on Stack Overflow See other posts from Stack Overflow or by William Pursell
Published on 2009-09-01T14:52:35Z Indexed on 2010/03/29 1:23 UTC
Read the original article Hit count: 399

I see a lot of questions, both here on SO and elsewhere, about "maintaining common libraries in a VCS". That is, projects foo and bar both depend on libbaz, and the questioner is wondering how they should import the source for libbaz into the VCS for each project.

My question is: WTF? If libbaz is a library, then foo doesn't need its source code at all. There are some libraries that are reasonably designed to be used in this manner (eg gnulib), but for the most part foo and bar ought to just link against the library.

I guess my thinking is: if you cut-and-paste source for a library into your own source tree, then you obviously don't care about future updates to the library. If you care about updates, then just link against the library and trust the library maintainers to maintain a stable API.

If you don't trust the API to remain stable, then you can't blindly update your own copy of the source anyway, so what is gained?

To summarize the question: why would anyone want to maintain a copy of a library in the source code for a project rather than just linking against that library and requiring it as a dependency?

If the only answer is "don't want the dependency", then why not just distribute a copy of the library along with your app, but keep them totally separate?

© Stack Overflow or respective owner

Related posts about build-process

Related posts about dependencies