Changes between Version 2 and Version 3 of Guidelines/MaintenanceGuidelines


Ignore:
Timestamp:
Nov 22, 2008, 9:46:21 PM (14 years ago)
Author:
viboes
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Guidelines/MaintenanceGuidelines

    v2 v3  
    1010This 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'''.
    1111
    12 The difference between '''breaking changes''' and '''bugs''' concerns documentation. A documented modification breaking user code cannot be considered as a bug while the same undocumented modification could be a bug.
    13 
    14 The key issues are:
     12The 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
     14The key issue are:
    1515 * Documenting and tracking the changes.
    1616 * Avoiding completely silent breakage by a deep inspection of code changes.
     
    1919 * Versioning individual Boost.Libraries.
    2020
    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 contains some guidelines related to the code itself.
    22 
    23 But, why can user code break when upgrading Boost?
     21These 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
     23But, why user code can break when upgrading Boost?
    2424
    2525 * '''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 that the addition of namespaces, classes, function, variables at the namespace level or macros can also break user code. Note that modifications can be considered as deletion+addition.
     26It 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.
    2727
    2828The following user code example
     
    7979
    8080Adding macros
    81 We shouldn't have user code breaking if we preserve the macro naming rule BOOST_LIBNAME_NAME.
     81We should don't have user code breaking until we preserve the macro naming rule BOOST_LIBNAME_NAME.
    8282
    8383 * '''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. The 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.
     84Some 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.
    8585
    8686''Add an example on overloading''
    8787
    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.
     88These 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.
    8989
    9090
    9191= Deprecating features =
    9292
    93 ''To be added''
    94 
     93C++ do not have deprecated attributes, so the author needs to emulate a warning when some deprecated feature is used.
     94The #warning directive can be used to this purpose
     95
     96
     97{{{
     98  #warning "name is deprecated, please use new_name instead"
     99}}}
     100
     101The 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
     103For compatibility purposes deprecated features should be included by default.
     104If 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
     116Once 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
     121Deprecated 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].
    95127
    96128= Cross version testing =
    97 
    98129
    99130Running 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:
     
    116147
    117148== 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.
     149Tagging each library release with a version, is the better way to signal to the user of possible incompatibilities.
    119150
    120151== 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 notes and trac system traceability [author] ==
    125 The release notes should include
     152Each modification should be tracked with a ticket on the track system.
     153
     154
     155== Release note and track system traceability [author] ==
     156The release note should include
    126157    * 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.
    128159
    129160== Include a diff file showing the modification respect to the previous release [author, RM] ==
    130161This 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).
    131162
    132 = Coding =
    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 instead and prefix each symbol with them.
     163= Codding =
     164== Do not use using sentences [user] ==
     165As 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.
    135166
    136167Instead of doing
     
    154185
    155186
    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
     189Before 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
    158190
    159191{{{
     
    161193// boost/old_header_file.hpp
    162194// include whatever file is needed to preserve the old file contents
    163 #if defined(BOOST_WARNS_DEPRECATED) || defined(BOOST_WARNS_DEPRECATED_ON_1_40)
     195#if defined(BOOST_WARMS_DEPRECEATED) || defined(BOOST_WARMS_DEPRECEATED_ON_1_40)
    164196#warning "boost/old_header_file.hpp is deprecated, please include boost/new_header_file.hpp instead
    165197#endif
    166198}}}
    167199
    168 It will be up to the user to define the macros BOOST_WARNS_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.
     200It 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.
    169201
    170202== Do not delete namespaces prematurely [author] ==
    171203Use the using sentence to import from the new namespace to the old one.
    172204
    173 == Do not delete classes/functions/variables prematurely [author] ==
    174 Instead of deleting 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
     206Instead 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.
    175207
    176208{{{
     
    180212namespace libx {
    181213
    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
    184218#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
    186222
    187223  class name {
     224    name::name();
    188225    // as before
    189226  };
     
    192229}
    193230}
    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
     233When 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
     238namespace boost {
     239namespace 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] ==
     255Instead 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.
    201256
    202257
     
    205260= Test and Inspections =
    206261
    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 ==
     263A 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] ==
     268The 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] ==
     274It 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] ==
     277The 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