Vendor Branches: The Solution
In my last post (Vendor Branches: The Problem) I summarised the problems we have had managing what is commonly known as a vendor branch. In this post I will describe part of the solution we are successfully using.
A vendor branch is source code that is sourced from, and maintained by, a third party (the “vendor”). We want to customise it, but we want to be able to safely update our customised version from the vendor’s version any time we choose, without losing our customisations. We achieve this through our code design, unit tests, and by using Mercurial.
Code Design
Perhaps the most important thing is to avoid changing the vendor’s code. Of course, if it was always possible to avoid changing vendor code, there’d be few problems updating vendor code no matter how many customisations. However the bigger and more complex the system, the more difficult it is to avoid changing the vendor’s code.
Although big and complex, OfBiz is very helpful in this regard. Most customisation can be placed under the hot-deploy folder, which exists for that purpose. Entities are easy to extend by using entity-extend in the right places under hot-deploy. Services can be overridden. Form and menu widgets can be extended. All without touching the vendor code.
Despite this, there are plenty of reasons why we might need to change the vendor code. Sometimes we discover bugs, and need to fix them ourselves before we submit the patch to the vendor. Some customisations require changes to the vendor source, in a way that isn’t compatible with the built-in extension mechanisms.
Unit Tests
After every update of the vendor code, we run our suite of unit tests. This is an important part of ensuring the vendor update didn’t break anything.
Mercurial
While code design and unit tests are important, the tool that does most of the work for us is Mercurial along with its Queues.
In my next post, I’ll explain how we use Mercurial and Queues to easily manage vendor code updates with a minimum of risk.
Next: Vendor Branches: Mercurial
Previous: Vendor Branches: The Problem
