Changes between Version 2 and Version 3 of Guidelines/MaintenanceGuidelines
- Timestamp:
- Nov 22, 2008, 9:46:21 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Guidelines/MaintenanceGuidelines
v2 v3 10 10 This page describes guidelines that could be followed by the Boost community '''to avoid user code breaking when the user upgrades to a more recent Boost release'''. 11 11 12 The difference between '''breaking changes''' and '''bugs''' concerns documentation. A documented modification breaking user code can not be considered as a bug while the same undocumented modification could be a bug.13 14 The key issue sare:12 The difference between '''breaking changes''' and '''bugs''' concerns documentation. A documented modification breaking user code can not be considered as a bug while the same non documented modification could be a bug. 13 14 The key issue are: 15 15 * Documenting and tracking the changes. 16 16 * Avoiding completely silent breakage by a deep inspection of code changes. … … 19 19 * Versioning individual Boost.Libraries. 20 20 21 These guidelines are related mainly to how to document changes. There are also some guidelines that can be followed to detect breaking changes either by test or by inspections. And of course this pages also containssome guidelines related to the code itself.22 23 But, why can user codebreak when upgrading Boost?21 These guidelines are related mainly to how to document changes. There are also some guidelines that can be followed to detect breaking changes either by test or by inspections. And of course this pages contains also some guidelines related to the code itself. 22 23 But, why user code can break when upgrading Boost? 24 24 25 25 * '''Syntactical''' breaking: detected at compile time 26 It is evident that the removal of files, namespaces, classes, function, variables or macros could break user code. What it is less evident is th at the addition ofnamespaces, classes, function, variables at the namespace level or macros can also break user code. Note that modifications can be considered as deletion+addition.26 It is evident that the removal of files, namespaces, classes, function, variables or macros could break user code. What it is less evident is the addition namespaces, classes, function, variables at the namespace level or macros can also break user code. Note that modifications can be considered as deletion+addition. 27 27 28 28 The following user code example … … 79 79 80 80 Adding macros 81 We should n't have user code breaking ifwe preserve the macro naming rule BOOST_LIBNAME_NAME.81 We should don't have user code breaking until we preserve the macro naming rule BOOST_LIBNAME_NAME. 82 82 83 83 * '''Semantical''' breaking: detected at runtime 84 Some times the user code will compile with the upgraded Boost release, but the code will not behave as before. Thekind of changes that could lead to this situation must be over documented because the compiler can not help the user to catch the breaking code.84 Some times the user code will compile with the upgraded Boost release, but the code will not behaves as before. This kind of changes that could lead to this situation must be over documented because the compiler can not help the user to catch the breaking code. 85 85 86 86 ''Add an example on overloading'' 87 87 88 These guidelines are not only addressed to the Boost library authors, but also to the users and the release manager team (RM). Every member of the Boost community has his role to play. Note that the author plays also the role of user of all libraries on which his library depends and on his own library when writing the library tests.88 These guidelines are not only addressed to the Boost library authors, but also to the users and the release manager team (RM). Every member of the Boost community has its role to play. Note that the author plays also the role of user of all libraries on which its library depends and on its own library when writing the library tests. 89 89 90 90 91 91 = Deprecating features = 92 92 93 ''To be added'' 94 93 C++ do not have deprecated attributes, so the author needs to emulate a warning when some deprecated feature is used. 94 The #warning directive can be used to this purpose 95 96 97 {{{ 98 #warning "name is deprecated, please use new_name instead" 99 }}} 100 101 The main problem is that this warning will appear independently of whether the user code uses or not the deprecated feature. In order to palliate to this the inclusion of the deprecated feature could be accessible conditionally and only when included the warning will be reported or not. 102 103 For compatibility purposes deprecated features should be included by default. 104 If a user don't want to include a deprecated feature he/she can define one of the following macros: 105 106 '''BOOST_DONT_INCLUDE_DEPRECATED''': don't include any deprecated feature. 107 108 '''BOOST_DONT_INCLUDE_DEPRECATED_ON_X_Y''': don't include any deprecated feature to be removed on version X.Y. 109 110 '''BOOST_LIBX_DONT_INCLUDE_DEPRECATED''': don't include any deprecated feature for library Boost.LIBX. 111 112 '''BOOST_LIBX_DONT_INCLUDE_DEPRECATED_ON_X_Y''': don't include any deprecated feature for libarary Boost.LIBX to be removed on version X.Y. 113 114 '''BOOST_LIBX_DONT_INCLUDE_DEPRECATED_NAME''': don't include the deprecated feature name. 115 116 Once one of this macros is defined the author can define another macro to make easier the work. 117 118 '''BOOST_LIBX_NAME_DONT_DECLARED''': states that the deprecated feature name has not been declared 119 120 121 Deprecated warning are not reported by default. If the user wants this deprecated warnings to appear he/she can define one of the macros: 122 123 '''BOOST_WARMS_DEPRECEATED''': warms on all deprecated features 124 '''BOOST_WARMS_DEPRECEATED_ON_X_Y''': warms on all deprecated features to be removed on version X.Y 125 126 [wiki:Guidelines/MaintenanceGuidelines#delete_files See the examples below]. 95 127 96 128 = Cross version testing = 97 98 129 99 130 Running the regression tests from the _previous_ major release against the current release is a way to automatically detect and flag interface/behavioral changes. Sure, there are many potential problems with such an approach: … … 116 147 117 148 == Tag Boost library with specific library version [author] == 118 Tagging each library release with a version, is the better way to signal possible incompatibilities to the user.149 Tagging each library release with a version, is the better way to signal to the user of possible incompatibilities. 119 150 120 151 == Create a Feature Request ticket for each deprecated/suppressed/modified/new feature [author, user] == 121 Each modification should be tracked with a ticket on the trac system.122 123 124 == Release note s and tracsystem traceability [author] ==125 The release note sshould include152 Each modification should be tracked with a ticket on the track system. 153 154 155 == Release note and track system traceability [author] == 156 The release note should include 126 157 * the list of all the bug tickets that have been solved 127 * the list of all deprecated/suppressed/modified/new features with their associated tickets.158 * the list of all deprecated/suppressed/modified/new features with its associated ticket. 128 159 129 160 == Include a diff file showing the modification respect to the previous release [author, RM] == 130 161 This file is the explicit report of all the changes in the library. It could be used by the Boost community to inspect that every change has been correctly documented (see inspections bellow). 131 162 132 = Cod ing =133 == Do not use using directives [user] ==134 As seen before , using directives in user code is one of the sources of user code breaking, so it will be safer to use namespace synonyms insteadand prefix each symbol with them.163 = Codding = 164 == Do not use using sentences [user] == 165 As seen before the use of using sentences in user code is one of the source of user code breaking, so it will be safer to use instead namespace synonyms and prefix each symbol with them. 135 166 136 167 Instead of doing … … 154 185 155 186 156 == Do not delete files prematurely [author] == 157 Before deleting a file, "file.hpp", deprecate it and let the user modify his code during some versions (e.g. until 1_40). Replace it by 187 == Do not delete files prematurely [author] == #delete_files 188 189 Before deleting a file "file.hpp" deprecate it and let the user modify its code during some versions (e.g. until 1_40). Replace it by 158 190 159 191 {{{ … … 161 193 // boost/old_header_file.hpp 162 194 // include whatever file is needed to preserve the old file contents 163 #if defined(BOOST_WAR NS_DEPRECATED) || defined(BOOST_WARNS_DEPRECATED_ON_1_40)195 #if defined(BOOST_WARMS_DEPRECEATED) || defined(BOOST_WARMS_DEPRECEATED_ON_1_40) 164 196 #warning "boost/old_header_file.hpp is deprecated, please include boost/new_header_file.hpp instead 165 197 #endif 166 198 }}} 167 199 168 It will be up to the user to define the macros BOOST_WAR NS_DEPRECATED and BOOST_WARNS_DEPRCEATED_ON_1_40 when the user wants to be warmed for deprecated features on Boost or on the Boost version 1.40 respectively.200 It will be up to the user to define the macros BOOST_WARMS_DEPRECEATED and BOOST_WARMS_DEPRECEATED_ON_1_40 when the user wants to be warmed for deprecated features on Boost or on the Boost version 1.40 respectively. 169 201 170 202 == Do not delete namespaces prematurely [author] == 171 203 Use the using sentence to import from the new namespace to the old one. 172 204 173 == Do not delete classes/functions/variables prematurely [author] == 174 Instead of delet ing a class on the next version protect its definition by BOOST_DONT_INCLUDE_DEPRECATED or BOOST_LIBX_DONT_INCLUDE_DEPRECATED.205 == Do not delete classes/functions/variables prematurely [author] == #delete_cpp_symbols 206 Instead of delete a class or a public/protected function/variable on the next version protect its declaration by any of the DONT_INCLUDE_DEPRECATED macros. 175 207 176 208 {{{ … … 180 212 namespace libx { 181 213 182 #if defined(BOOST_DONT_INCLUDE_DEPRECATED) || defined(BOOST_DONT_INCLUDE_DEPRECATED_ON_1_41) || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED) || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED_ON_1_41) || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED_NAME) 183 #define BOOST_LIBX_NAME_DONT_DEFINED 214 #if defined(BOOST_DONT_INCLUDE_DEPRECATED) || defined(BOOST_DONT_INCLUDE_DEPRECATED_ON_1_41) \ 215 || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED) || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED_ON_1_41) \ 216 || defined(BOOST_LIBX_DONT_INCLUDE_DEPRECATED_NAME) 217 #define BOOST_LIBX_NAME_DONT_DECLARED 184 218 #else 185 #warning "name is deprecated, please use new_name instead" 219 #if defined(BOOST_WARMS_DEPRECEATED) || defined(BOOST_WARMS_DEPRECEATED_ON_1_40) 220 #warning "name is deprecated, please use new_name instead" 221 #endif 186 222 187 223 class name { 224 name::name(); 188 225 // as before 189 226 }; … … 192 229 } 193 230 } 194 195 }}} 196 197 The same applies to functions and variables. 198 199 == Do not modify functions prototype prematurely [author] == 200 Instead of modifying an existing function prototype, do as if you were deleting it and adding the new one. As both prototypes should coexist for some releases, check if this overloading could cause user code breaks. 231 }}} 232 233 When the declaration should not been included, the author could define a BOOST_LIBX_NAME_DONT_DECLARED, which could be used on the class/function/variable definition. E.g. 234 235 {{{ 236 #!cpp 237 // boost/libx/header_file.cpp 238 namespace boost { 239 namespace libx { 240 241 #if defined(BOOST_LIBX_NAME_DONT_DECLARED) 242 #else 243 name::name() { 244 // as before 245 } 246 // as before 247 #endif 248 249 } 250 } 251 }}} 252 253 254 == Do not modify functions prototypes prematurely [author] == 255 Instead of modifying an existing function prototype, do as you were deleted it and added the new one. As both prototypes should cohabit during some releases, check if this overloading could cause user code breaks. 201 256 202 257 … … 205 260 = Test and Inspections = 206 261 207 == Regression Test and trac system traceability == 208 A bug ticket must be associated to a test case, either the test case exists already and there is a regression for some toolset, or a new toolset is considered, or a new test case is needed to check the bug is there (problem reproducible) and the modification solve the problem. 209 * State clearly which test cases prove the bug it it exists [user] 210 * Propose a new test case reproducing the bug [user] 211 212 == Preserve the test from the preceding versions as much as possible == 213 The tests from the preceding versions should not be changed when the author modifies its library. These unchanged tests are a probe of compatibility with the preceding version. When these tests must be changed they indicate a breaking user code issue. So instead of changing them, add new ones stating explicitly on which version they were included and remove these tests from the Jamfile. 214 262 == Regression Test and track system traceability == 263 A bug ticket should be associated to one or several test cases, either the test cases exists already and we are in face of a regression for some toolset, or a new toolset is considered, or a new test case is needed to reproduce the bug and the modification solve the problem. 264 * State clearly which test cases reproduce the bug it they exists [user] 265 * Propose a new test case reproducing the bug otherwise [user] 266 267 == Preserve the test from the preceding versions as much as possible [author] == 268 The test from the preceding versions should not be changed when the author modifies its library. These not changed tests are a probe of compatibility with the preceding version. When these test must be changed they indicate a breaking user code issue. So instead of changing them add new ones stating explicitly on which version they were included. Old tests that should fail can be moved to the compile_fail or run_fail tests on the Jamfile. 269 270 271 272 = Release Management = 273 == Announce new features on a library [author] == 274 It would be great if the author announce to the Boost mailing lists the new features just before committing in the release branch. This will let the time to the Boost community to inspect the modifications introduced. 275 276 == Inspect announced modifications match the real ones [author, user, RM] == 277 The use of the diff file will help to inspect that the modifications introduced have been correctly included on the documentation and a good test coverage has been done. This will result in a non official mini-review of the library. 278 279