grame-cncm / faustlibraries

The Faust libraries

Home Page:https://faustlibraries.grame.fr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

backwards compatibility strategy / library versioning

magnetophon opened this issue · comments

The context / "example case" of my question:

As I learn more about compressors, I'm finding things I should have done differently in the libraries.
For example, the smoothing should be done in the lin domain, not in the dB domain.
For the sake of argument, let's assume everyone agrees this sounds better in most cases (it does).
At the same time, for example master_me has it's presets written around the sound of the current implementation.
So even though it would sound better with the new implementation, the presets would have to be rewritten for that.

I could of course come up with a new name for the improved set of compressors and just add them to the pile, but that would get confusing for users and there'd be a lot of code duplication.
I could work around the code duplication by writing clever code, but that would make it harder to read and I think also slower to compile, which matters a lot when working on big algorithms.
And then in two months I find out I made another subjective mistake (spoiler alert: I did...) and I'd have to add yet another set of compressors.

The actual question:

The compressors are just an example.
How do we deal with this in the general case?

The cleanest solution I've come across so far is how Rust does it.
In the code, you (optionally) declare the version of the libraries you want to compile against. (simplifying here)
This allows the libraries to make breaking changes as needed, but downstream authors can upgrade if and when they want to.
Would this be a possible way forward for faust?

Side note:

In Rust, if you don't give a version number, you get the latest. (simplifying again)
This works for Rust, since the users of the libraries know this, so those who don't specify a version are OK with breaking changes.

In our case, it would defeat the whole point, cause none of the current code has any version numbers.
I see two solutions:

  1. We make a breaking change to make it work like Rust,
    It'd be like when everybody had to change their code to include library prefixes.
    It was a pain, and some code never got converted, but it was worth it, imho.
  2. If you don't specify a version you get a library version frozen in time.

That looks great!
I don't think my comments would improve it, since you already mentioned Cargo as an inspiration.

Hi Julius,

I agree backwards compatibility is very important, that's why I brought this up.
I was just thinking aloud on how to best achieve it.

I can see the advantage of making a new name any time a breaking change is introduced.

On the other hand: sure, names are cheap, but if you can't find what you need, you might as well not have it.

There's a fine and subjective balance there:
I think it makes sense to have lot's of ways to generate a sine wave, since each has it's own advantages and disadvantages.
I don't hink it is a good user experience to have tons of legacy functions cluttering things up.
So far it's not too bad, but eventually there will be more legacy code than current code.

Cheers,
Bart.

On the other hand, if you can't break things then you end up with too many things. The purpose of a good library versioning system would be to inform people that there are non-backwards-compatible breaks. People should be able to continue to access the older version if they opt into it.

I am not worried about API bloat from the creation of new names, because that's already out of control to the point that I think a new set of small, focused, downstream libraries is needed.

What you call "a set of focused libraries" is at the core of what I'm talking about.
As far as I'm concerned, they do not need to be small, as long as they are well organized.
Part of that organization should be in terms of functionality and part of it should be in terms of time/version.

As far as I can tell, that is also what the faustideas link is talking about.