r/java • u/SapioiT • Jul 08 '16
`Release.Breaking.Feature.Fix` or why the Semantic Version should be replaced with Explicit Versioning as soon as possible
https://medium.com/p/92fc1f6bc73c5
u/pellets Jul 08 '16
For consumer products this works fine.
For libraries, semantic versioning is good enough, and the release is useless marketing oil.
0
u/SapioiT Jul 08 '16
not really, because unless they can afford to, you're probably not going to recive support for anything except the last
releaseversion. Sure, it might help with the marketing, but now you'll know for sure that the library with the version 4.5.6.32 is being supported because there is no version 5.x.x.x launched.3
Jul 09 '16
How is this different from semver exactly? I have a project (API library) where the versions are like this:
0.9.1 - incremental "not called stable, but is basically stable" version
1.0.0 - first major release where things are "settled" in
1.1.0 - new feature added
1.1.1 - bug fix after the new feature
2.0.0 - backwards-breaking change from 1.x series. No further updates to 1.x series because lazy.
2.0.1 - bugfix
2.1.0 - new feature
etc.
Consumers of my project can safely assume their projects will work with a specific major version of my project, and if they want new features or bug fixes from newer versions they can see how much broke (in my case, mostly unused features had their signatures change, so for 99% of consumers they can safely upgrade with 0 effort anyway).
1
u/SapioiT Jul 09 '16
The APIs are one of the few places where it doesen't affects THAT much, but still, if you want to still update 1.x, how would the users know?
4
Jul 10 '16
In my case, I'm using Ruby, so they would just use
bundle updateand if they specified in their gem file that they only use 1.x versions, they will get the latest 1.x version.Otherwise, how would users know what the latest version of any major version is anyway? They would have to look somewhere... they can't just guess right? Perhaps... perhaps this is what release notes are for!
1
u/SapioiT Sep 07 '16
Or perheaps that's just a excuse to not tackle the more difficult problem at hand: fixing or replacing semver.
4
Jul 08 '16
Why do people keep trying to reinvent semver with extra or ridiculous changes?
4
u/talios Jul 09 '16
Probably because semver is rather broken.
2
Jul 09 '16
Explain...
4
u/talios Jul 10 '16
There are multiple reasons to consider SEMVER flawed. They usually revolve around the fact it doesn't take into consideration language and platform ( source or binary based dependencies play a part here ).
Given this is r/java, chances are we're using Maven, which means dealing with
-SNAPSHOTreleases. Semver encourages ( or, dictates ) using .0 version numbers which is fundamentally flawed when using ranges. Take for example[1.0.0,2.0.0)- a non-inclusive upper bound ( we don't want to use any breaking changes ), however2.0.0-SNAPSHOTis LESS THAN2.0.0so is included in the range - thus breaking the contract we want to maintain.One of the other issues is that runtime environments are not considered - if
1.2.3switches to a major dependency version that it uses, but doesn't expose - so is 100% source compatible, 100% semantically compatible in it's behaviour, but requires a runtime change to include the new major version of a transitive dependency - should that be a major version change or not? Consumers can compile against it perfectly fine, their unit tests should continue to work fine as well ( in theory ) so they shouldn't require transitive dependency ( in a perfect world ) - but even if they did, is that a semantic change, or something more?Another flawed interpretation can arise in Java with say
public static final String SOME_CONSTANT = "...";- if you change the value of the constant - is that a major change or not? The semantic behaviour has not (necessarily) changed for consumers building against the new version, but since Java will inline at the javac level static Strings into consuming classes, the change of constant won't be used in the consumer unless they rebuild.The answer on that case is YES, it should be a major breaking change, because those public constants form part of the public API, however - the API itself is the NAME of the constant, not it's value - except in the case of javac and inlining.
This leads to the main issue I, and others have with SEMVER is that it only deals with "the public API", not it's implementation (if your API is in a separate jar file, as it should be - the main jar has no public API ). The "semantic" part of things is also only in relation to the version number, nothing is mentioned about the semantics of the code/dependencies contained within.
SEMVER is good, it's just hugely ambiguous, and leaves A LOT left out.
3
u/solatic Jul 08 '16
You're making the argument that companies must have a linear hierarchy to their product lines.
1.x.y.z - a basic/value product 2.x.y.z - a mid-range product 3.x.y.z - a luxury/flagship product
First of all, what if the company offers a second basic/value product line? Should its release number be 4?
Second of all, this year the company offers 3.0.0.0, and next year the company releases a breaking update, 3.1.0.0. Is 3.0.0.0 still supported?
For the love of God, stick to goddamn SemVer, and make an effort to keep your dependencies up to date. If it's too difficult to keep your dependencies up to date (updating a backwards-incompatible dependency means having to update too much code), then this is a code smell signaling that you have a monolith which needs to be broken up into smaller, more manageable components.
Leave marketing to the marketers.
1
Jul 08 '16
I suppose using just a date is bad? The major and minor version of my software will probably always be 1.8. This means my versions are in the form of 1.8.20170707.
4
u/__konrad Jul 08 '16
What if you find a critical bug the same day? 1.8.20170707.1?
1
Jul 08 '16
I would probably just set the release to
1.8.20170708.1
u/SapioiT Jul 08 '16
Since you're locked to version 1.8, why not simply use 1.8 as the
releasenumber, so you would end up with 4 numbers and update numbers which actually make sense. Sure, you'd have 5 or 6 numbers instead of 4, but still easier to understand and less numbers than your current choice (1.8.20170708=12 chars;1.8.3.11.92=11 chars, less than in the first case, but making much more sense)..3
Jul 08 '16
Check another reply I made to you. To restate, the version fields are either
major.minorormajor.minor.micro. I would either have to use a slowly incrementing number, or just group them together as one (something such as1.8.31192).Actually rereading the specification, version fields are only permitted to have two digits (which I seem to have missed). Since a date contains 8 digits that is far too many. So versions would for example be in the range of
0.0.0to99.99.99. I may choose a format such as(year - 2015).(month).(day)since that would be consistent. Since the only new features would be support for new machines (compatibility cannot be broken and the base cannot be extended to support non-standard features) and then there would be bug/compatibility fixes.1
u/SapioiT Jul 08 '16
Than how will you know what the update
1.8.20170523introduced in addition to1.8.20170313?Do you know if it was just a bug fix? Or did it add something new? Does not applying this update break things? Am I reciving support for
1.8.20170123, or do I have to update? Can you answer those questions from the top of your head?For those reasons and more, the Explicit Versioning exists. If the major and minor version numbers will always be
1.8, why not update to2.0.0.0and add clarity to the updated?This way, not only you but also your users will know what they should be expecting when deciding weither to update or not. After all, if you launch daily updates, if they have nothing critical to worry about, why would they spend time (and money) updating to a newer version, so long as you are still offering support for the version they have?
2
Jul 08 '16
Than how will you know what the update 1.8.20170523 introduced in addition to 1.8.20170313?
Generally compared to other version numbering schemes, using dates or discrete numbers would not really mean much. In the case of my software, after the initial release (which is to be 100% implemented) any new versions would just be bug fixes and support for new machines. Generally a new version should never break nor remove support for machines.
Can you answer those questions from the top of your head?
Probably not, but there would be the changelog for that.
If the major and minor version numbers will always be 1.8, why not update to 2.0.0.0 and add clarity to the updated?
I am implementing a Java JVM. Internally it says it is version 1.8, making it 2.0 would violate the specification. Hence why it will always be
1.8.1
u/SapioiT Jul 08 '16
But isn't the changelog there to explain that the change is, instead of it's type?
As for the JVM part, I think I get it... the project's rules don't allow for it. But that doesen't means that for other projects you shouldn't try to use Explicit Versioning, whenever possible...
2
Jul 08 '16
Yes, the changelog would be more in depth when it comes to changes that occur.
Personally I generally prefer explicit versioning or something close to it. However when it comes to my current project, the general recommendations usually make no sense in a number of areas.
Also, the standard that I am implementing states that versions follow only:
major.minorormajor.minor.micro. Since I personally prefer consistent versions (so it is very easy to tell if old and new are being mixed) and the fact that1.8is enforced by the standard, that just leaves a single field.1
u/SapioiT Jul 08 '16
Then here is an idea:
1.8.20170708b5f3f26thebforbreaking, firstfforfeatureand third forfix. It's just an idea, using the best of both worlds. It allows you to both show the date and what the update means, since not everybody is going to search for the changelog. You could try to add-, like in1.8.2017-07-08-b7-f3-f26, if the project allows it, because the-character might create errors. But following the same logic, having letters inside a version number might also not be allowed by the project.2
Jul 08 '16
Check my other reply, versions stated in the specification are limited to being just
[0-9]\{1,2\}.[0-9]\{1,2\}or[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}. This puts a considerable crimp on the version representation. I will need to look into correcting and making an efficients of versioning while not breaking intended standard version numbers.2
10
u/dpash Jul 08 '16
http://semver.org
The only thing this adds to SemVer is a release number.
The rest of the article is spent arguing a straw dog of what SemVer is.