Search code examples
coding-stylebackwards-compatibilitymethodology

Is there a methodology to avoid backwards incompatibilty that is sometimes enforced upon us?


Sometimes, 3rd party libraries cause havoc when they change their interface. In some languages, it even happens on the language level.

Is it possible to write our code in a way that will prevent it?

For instance, I can think of one way - writing your own wrapper functions.
In that way, the changes will be localized to one function. But then again, it creates a large overhead.

Do you have any ideas?


Solution

  • Apple suggests to its developers the idea that your code can check for versions; then you can update your code as needed when a version changes. Here's a link to their more thorough discussion:

    Mac OS X Developer Release Note

    Basically, they provide markers that can be used in header files to indicate the max version in which a component is meant to be used or is known to work.