| If used with a proper versioning system (based for example on something like RubyGems' "gem 'library_name', '>= 3.1', '< 4.0'" attached to the client code), this could result in a quite nice approach to API evolution, couldn't it? The infrastructure would ensure that you would have a class with proper version available, so you could avoid writing the ugly code testing for availability of the methods you would like to use. On the other hand you would be obligated to increase the major version number of the library every time you introduce any backward-incompatible change to it. It would be nice to have such version numbers generated automatically, but because it is impossible to do it 100% correctly (think about semantic changes, time or memory effectiveness, etc.), letting the author of the library to assign the version numbers seems like a reasonable approach. | | If used with a proper versioning system (based for example on something like RubyGems' "gem 'library_name', '>= 3.1', '< 4.0'" attached to the client code), this could result in a quite nice approach to API evolution, couldn't it? The infrastructure would ensure that you would have a class with proper version available, so you could avoid writing the ugly code testing for availability of the methods you would like to use. On the other hand you would be obligated to increase the major version number of the library every time you introduce any backward-incompatible change to it. It would be nice to have such version numbers generated automatically, but because it is impossible to do it 100% correctly (think about semantic changes, time or memory effectiveness, etc.), letting the author of the library to assign the version numbers seems like a reasonable approach. |
| + | Re: ''proper versioning system''. Exactly, proper versioning system is very important prerequisite for good API design. The JDK (up to version 6) suffers from not using versioning system, so do regular Java applications. On the other hand, this is not weakness of [[Java]]. [[NetBeans]] have its module system and there is [[OSGi]]. Both these systems allow to precisely express the required APIs together with their minimal version. They also support some kind of major incompatible version release. Similar to Gems, I guess. You are right that we are missing tools that would guarantee easy [[Upgradability]] of one version by another, so it is more or less matter of common sense and compatibility rules awareness of the library author. |
| + | I guess that, if [[TheAPIBook]] offers some knowledge not widely spread among the Java SE community, then it is the modularity, its use and benefits. The book propagates use of module architecture in [[Use_Modular_Architecture|Chapter 7]], it describes few adventures when trying to make multiple versions of the same library co-exist with each other in [[Evolving_the_API_Universe|Chapter 15]] and finally it also shows the advantages of proper versioning for ''end of life'' policies in [[End_Of_Life_Procedures|Chapter 19]]. I believe modularity is necessary component for modern applications in any language. |