For some time I wrote every bit of my code by myself without using external sources. However after my problems became more complicated I decided to use external libraries. For example to save and inspect the solutions of my computations, I chose to use vtk. I understand, that I cannot write everything on my own, but I am worried about new releases of these external libraries that might not be compatible with their previous versions. Should I adapt my code all the time to the newer releases? I am afraid that if I will have to reinstall my system in the future, I won't be able to run my code.
Lets assume typical versioning semantic as a.b.c, in that case:
- a - MAJOR version, where incompatibilities and API changes can occur,
- b - MINOR version, where new functionality can be added but in a backwards-compatible manner,
- c - PATCH version, where backwards-compatible bug fixes are made.
If you stick for example with the version a1.b1.c1 you application should compile and work smoothly for any changes of b1 and c1 and constant a1.
Should I adapt my code all the time to the newer releases?
It should not be required to change anything in your application when MINOR or PATCH were changed. In case of MAJOR releases it depends. In case of scientific libraries, major changes of APIs are quite rare and always somehow advertised before release.
You application can require a specific version of external libraries to build. It is fine and it should not be a problem to build it either in huge systems (like clusters or super computers) where solutions like Environment Modules are frequently used to solve multi-lib problems.
You did not mention anything about build system, which you are using. Forcing a specific version of the library can solve your problem and it is very easy to achieve in case of CMake or similar build systems.
You can build necessary libraries from sources rather than use those provided by the operating system repositories (yum, apt). Moreover, you can deliver with your software a specific version of external libraries which were tested with your software and works. But in case of huge libraries it does not have any sense.
If you want to support many versions of external libraries you can always prepare some unit tests to validate the results of important methods which use external APIs to ensure that everything is working properly.
In case of VTK I would not worry. It is very well written library, widely used everywhere. Major changes should not break your application.