Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have an app that is made up of multiple different components, each with their own version number and history. I would like to create a version number of the entire application, preferably somehow based on the version numbers of the components. I am not sure if this is possible at all, but I would like:

  • The version number be unique for each version of the components, so that when I upgrade the version number of one of the components, the version number of the whole app will change as well, and the number must not be ambigous so that it could refer to some other constellation of components.

  • It would be nice if there was a way to reverse the process to go from a combined version number to see what versions of components it consists of.

  • It is also nice if the combined version number is not too long to remember

  • It's a plus if the combined version number always increases with the increase of a component version number.

I am aware that some of these desires are not possible to accomodate together (such as short AND reversable since you would lose information when shortening)

The easiest approach is of course to just add the version number together in a long row, but that would be too long to be practical. Another is to create some kind of hash, but it would not be very readable.

Is there a standard way of doing this? Or will I have to name the major version manually and take note of what component versions it consists of?

share|improve this question
    
The biggest issue with your requirements is, that (2) and (3) are conflicting goals: For (2) you need an unlossy compound version number, which will be by definition hard to memorize the more components you add, thus violate (3). If you optimize for (3), then a lossy compound version number will be more or less like a hash: short, but irreversible. –  JensG Feb 19 at 17:52
    
@JensG You are correct, I also mentioned this in my question. What I realized is that I'm surely not the only one who has this problem; so I'm really looking for ideas as to how this is usually done. But it seems there is no standard or best practice? –  JoelWKall Feb 21 at 7:24

2 Answers 2

up vote 1 down vote accepted

That's what version control systems are for. Properly set up and used, they allow you to keep track of the released versions along with all of their dependencies used.

To get a short cut from "official" version number to source code revision, the CVS revision number(s) can be compiled into the binaries through different ways. Most CVS offer also some built-in support for this. For example, we put that info into the version resources of our Windows binaries and use SubWCRev for some special cases.

If you need/want all the information about the components used as human readable information in your programs, add it to the "Info/About" box or whatever the equivalent of it is. If do it cleverly, like using a readonly edit field, anyone will be able to copy+paste the info, if such is needed.

share|improve this answer

For your last requirement (monotonicity in numbering generations) you didn't specify anything further (e.g. some components have larger impact and therefore advance the total version in larger steps) so it would be easy to devise a simple addition of all version numbers which guarantees ever-increasing numbers on the same branch (i.e. furthermore only advancing one component), but the impossibility to define a total ordering will make this solution quite unattractive. OTOH the ability to roughly sort the total version number at first glance is one of the most important, otherwise you could go with a completely cryptic hash function. So first make clear if you are able to define a hierarchy of components based on their importance. If not, only a function which is able to look back in history (in a database at your site) is able to produce and decode version numbers.

share|improve this answer
    
I could probably define a hierarchy of the components based on importance, if that makes it easier. However, there might be additional components in the future, altough I think it could be safe to assume that they will be of the least importance. –  JoelWKall Jan 21 at 13:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.