Open Source Development
I have been working on quickly integrating an open-source library into an application I have been writing. This is my first large-scale experience with open source, and it has been an interesting one. I did think twice about naming the library as it very popular and well respected and I have had problems integrating it.
Disclaimer: The only intention of this post is to illustrate my experience (and probable ignorance) of the open source development process. It is not meant to stir up controversy.
The library (and application suite) in question is Subversion. The point of this post is to describe issues I have had around using open source projects. In no particular order:
Getting The Libraries.
It is fairly obvious where to find the source code and headers. It is also fairly obvious where to get the binaries. It is not obvious to me where to get the complete set of binaries, source code, static libs and headers.
It seems that there are a relatively small number of public projects using the Subversion libraries. Those projects that are open source, only expose their source code in their repositories.
Call me old fashioned, but if I build something I usually want all the parts from front-to-back wherever possible. At the very least I want the minimal set of libs, headers, and binaries to get ‘hello world’
compiling and working.
To do this I had to:
- Get the binary distribution.
- Get the libs and headers distribution.
- Search around for some other pieces (including libdb44.dll).
No matter how hard I searched, I could not find a full ‘developer’
distribution of the Subversion 1.5.x libraries.
As far as I am concerned this should include a complete cut of all source code for Subversion, plus the necessary headers and binaries of any other projects that Subversion is built on.
Documentation and C++
I use C++. So straight away I started wrapping the C-api to make it more friendly and abstracted for the things I want to do. This of course means using RAII and other common-place patterns. My main issue here is that I could not find any documentation with a clear, well explained ‘Hello World!’ style example (to perpetuate the problem, I will not post an example either).
The Doxygen documentation of the C-api, whilst useful, was far from complete. As I work on Windows, I am somewhat lucky to be using Visual Studio and Visual Assist which between them give me a fairly powerful and extensive Intellisense/code completion. I found this to be considerably more helpful than the available documentation.
Skinning the Apr-Cat
This was also my first experience of any project built on top of the Apache Portable Runtime. I don’t really have any comment about this.
The headers and binaries are shipped with Subversion, and they are fairly well and widely documented. I have no reason to use it, other than what is required by Subversion.
However, to make apr more C++, I started to use the RAII idiom, as mentioned earlier, and very quickly came across the RapidSVN C++ Subversion wrapper, which coincidentally appeared to be almost identical to the C++ wrapper I had started to write.
RapidSVN / svncpp
At this point I threw away the code that I had started to write (hence the lack of my own ‘Hello World!’ example) and chose to use the RapidSvn SvnCpp
wrapper. I would strongly recommend any C++ developer looking to integrate Subversion use this.
However, there are a few things wrong with the version I picked up. Firstly, I’m assuming, perhaps incorrectly, that whilst there are named branches and tags in the RapidSvn svn repository, taking the trunk will give me the most up to date and complete API. I found that a few api calls only partially populated a struct. This was relatively simple to fix.
My Own Repository
Every developer has their own style of coding and file layout. As a Windows developer, and being well versed in how awkward Visual Studio can be, I often spend some time moving projects around to suit my build structure. My personal preference is to have the minimal number of include lines in my projects. This is usual just ‘$(SolutionDir)’. In other words, my VS solution sits at my root level, and everything else is underneath it.
The one problem I had with RapidSvn/SvnCpp, is that I like my libraries to be self contained with minimal interfaces, so I was somewhat disappointed to find that after I finally built svncpp and included it in my project I found that I had to add extra include paths to my main projects to include the Subversion includes, included by svncpp in its headers. In other words, from my perspective, svncpp ‘leaks’ some Subversion headers.
So there and then I wrapped the svncpp code in another lightweight wrapper that contained a pimpl. This nicely fits in with how I like to build my projects.
Finally
So I finally have a built project of svncpp (containing svn) that is self contained that I can include and link to without any adjustment to my main project. In fact I have two versions, for Subversion 1.4 and 1.5.
As a result of all this extra work and configuration, in my own repository I now have complete snapshots of everything I need to build and ship an application built on top of Subversion. It is also in a state where I can drop in new revisions of both the svncpp and Subversion source code, headers, and binaries without any effort.
More Open Source?
This has been an interesting process to go through. Though it does beg the quest about Open Source development. It seems that lots of projects use lots of other projects with considerable amounts of configuration performed by scripts (make configure). Perhaps Visual Studio is part of the problem, but my feeling is that if Project A needs Project B version 1, and Project C version 2, then Projects B and C should provide, at the very least a zip file containing headers and binaries where necessary, and Project A should contain a link to that in a readme file or something similar.
Zero-configuration is also something I prefer. I should be able to build things ‘out of the box’, which is often what ‘make configure’ does on *nix systems.
More intelligent building and configuration could be used. I cannot see that it is particularly difficult to write a cross platform perl script that on an internet connected machine, does a svn checkout of the extra bits and pieces of project B and C that are required (assuming they use Subversion of course). The only requirement on developers (particularly on Windows), is to have the svn binaries and an perl installation in your PATH. If you’re a developer this should be an issue. If it is an issue, you shouldn’t be a developer.
Whilst I very much enjoy Open Source software, the development process (being a user of, not a developer of) has left me a little uneasy due to the inherent disconnectedness of projects and project dependencies. If I cannot build ‘out of the box’ I feel there is something wrong (see item 2 for a one click build).
I would just like to finally emphasize that I am not singling out Subversion (or RapidSvn) here as they are both great projects, I am just stating my experiences with multiple Open Source projects.