Menu

#1520 AMF: Refactoring for 5.0

future
unassigned
None
enhancement
amf
-
major
2016-01-28
2015-10-06
No

This is a 5.0 ticket for continue code re-factoring of the AMF service for 4.6. The work started with #94 in 4.4
and continued in #713 in 4.5 and #1142 in 4.6.
This ticket is to continue the work started in #94, #713 and #1142 to get
a more maintainable, understandable and testable code base.
We should aim for many small changes instead of few big ones.
The Google C++ Style Guide is to be followed and Google's cpplint to be run on the code base.

An ordered list, (highest priority first), of things to work on, for each task sub tasks
can be added together with a separate ticket:

  • Replace legacy data structures such as lists with STL std::vector (prefered), std::list etc. [#1543]
    • Change SU::list_of_susi and SI:: list_of_sisu to std::vector HansN
      -
  • Replace internal use of SaNameT with std::string [#1537]
  • Use std::maps instead of Patricia trees. [#1656]
  • Reduce duplicate code.
  • Improve cyclomatic complexity (McCabe) numbers.
  • Simplify conditional statements. [#1538]
  • Reduce the amount of 'nesting' in the code
  • Split up long functions into smaller ones doing one things and not many.
  • Convert model derived C structs to classes and change functions into methods.
  • Use bool which is a native type in C++ (and remove SaBoolT)
  • Write unit-test when refactoring code into units.
  • Setup unittest framework for amfa and amfnd [#1610]
  • Reduce number of casts in the code (introduced because of C++ files)
  • Remove use of EDU and do direct encode/decode [#1544]
  • Change macros to (inline) methods
  • Use design patterns where appropriate.
  • Change bit fields (flags) to boolean attributes (see https://sourceforge.net/p/opensaf/tickets/717/#d4b2)

Investigations that can be done:
- Use Boost libraries that requires only the boost header file, e.g multiindex.
- Introduce two builds, debug and product, e.g debug build can be used for various support during development, e.g. defensive programming , additional compiler options, e.g. -Weffc++ , etc.
- Investigate if pointers in data structure can be changed to a class (owns/uses relationships) that maintains referential integrity in the internal data structures.
Non C++ related changes:
- Use UML, (which tool?) to document parts of the design, sequence diagrams, state charts, etc.

Related

Tickets: #1520
Tickets: #1537
Tickets: #1538
Tickets: #1543
Tickets: #1544
Tickets: #1547
Tickets: #1551
Tickets: #1558
Tickets: #1571
Tickets: #1610
Tickets: #1656
Tickets: #1662

Discussion

  • Hans Nordebäck

    Hans Nordebäck - 2015-10-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -9,7 +9,7 @@
     can be added together with a separate ticket:
    
     - Replace legacy data structures such as lists with STL std::vector (prefered), std::list etc.
    -   - Change SU::list_of_susi and SI:: list_of_sisu to std::vector [#1234] HansN
    +    - Change SU::list_of_susi and SI:: list_of_sisu to std::vector [#1234] HansN
        -
    
     - Use std::maps instead of Patricia trees.
    @@ -27,9 +27,9 @@
     - Use design patterns where appropriate.
     - Change bit fields (flags) to boolean attributes (see https://sourceforge.net/p/opensaf/tickets/717/#d4b2)
    
    -- Investigations that can be done:
    -- Use Boost libraries that requires only the boost header file, e.g multiindex.
    +**Investigations that can be done:
    +**- Use Boost libraries that requires only the boost header file, e.g multiindex.
     - Introduce two builds, debug and product, e.g debug build can be used for various support during development, e.g. defensive programming , additional compiler options, e.g. -Weffc++ , etc.
     - Investigate if pointers in data structure can be changed to a class (owns/uses relationships) that maintains referential integrity in the internal data structures.
    -Non C++ related changes:
    -- - Use UML, (which tool?) to document parts of the design, sequence diagrams, state charts, etc.
    +**Non C++ related changes:
    +**- Use UML, (which tool?) to document parts of the design, sequence diagrams, state charts, etc.
    
     
  • Hans Nordebäck

    Hans Nordebäck - 2015-10-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -11,7 +11,7 @@
     - Replace legacy data structures such as lists with STL std::vector (prefered), std::list etc.
         - Change SU::list_of_susi and SI:: list_of_sisu to std::vector [#1234] HansN
        -
    -
    +- Replace internal use of SaNameT with std::string
     - Use std::maps instead of Patricia trees.
     - Reduce duplicate code.
     - Improve cyclomatic complexity (McCabe) numbers.
    
     
  • Gary Lee

    Gary Lee - 2015-10-12

    created #1537 amfd: replace inernal use of SaNameT with std::string

     
  • Minh Hon Chau

    Minh Hon Chau - 2015-10-12

    created #1538 AMF: Simplify conditional statements

     
  • Hans Nordebäck

    Hans Nordebäck - 2015-10-13
     
  • Hans Nordebäck

    Hans Nordebäck - 2015-10-13

    created #1543 amfd: Replace legacy data structures with STL

     
  • Hans Nordebäck

    Hans Nordebäck - 2015-10-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -8,21 +8,21 @@
     An ordered list, (highest priority first), of things to work on, for each task sub tasks
     can be added together with a separate ticket:
    
    -- Replace legacy data structures such as lists with STL std::vector (prefered), std::list etc.
    -    - Change SU::list_of_susi and SI:: list_of_sisu to std::vector [#1234] HansN
    +- Replace legacy data structures such as lists with STL std::vector (prefered), std::list etc. [#1543]
    +    - Change SU::list_of_susi and SI:: list_of_sisu to std::vector HansN
        -
    -- Replace internal use of SaNameT with std::string
    +- Replace internal use of SaNameT with std::string [#1537]
     - Use std::maps instead of Patricia trees.
     - Reduce duplicate code.
     - Improve cyclomatic complexity (McCabe) numbers.
    -- Simplify conditional statements.
    +- Simplify conditional statements. [#1538]
     - Reduce the amount of 'nesting' in the code
     - Split up long functions into smaller ones doing one things and not many.
     - Convert model derived C structs to classes and change functions into methods.
     - Use bool which is a native type in C++ (and remove SaBoolT)
     - Write unit-test when refactoring code into units.
     - Reduce number of casts in the code (introduced because of C++ files)
    -- Remove use of EDU and do direct encode/decode
    +- Remove use of EDU and do direct encode/decode [#1544]
     - Change macros to (inline) methods
     - Use design patterns where appropriate.
     - Change bit fields (flags) to boolean attributes (see https://sourceforge.net/p/opensaf/tickets/717/#d4b2)
    
     
  • Hans Nordebäck

    Hans Nordebäck - 2015-10-14

    created #1544 AMF: Remove use of EDU and do direct encode/decode

     
  • Long H Buu Nguyen

    created #1547: amfd: convert NULL to nullptr

     
  • Long H Buu Nguyen

    created #1551: amfnd: convert NULL to nullptr

     
  • Long H Buu Nguyen

    • created #1558 amf: use nullptr instead of NULL macros.
    • created #1571 AMF: Use std::maps instead of Patricia trees.
     
  • Hans Nordebäck

    Hans Nordebäck - 2015-11-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -21,6 +21,7 @@
     - Convert model derived C structs to classes and change functions into methods.
     - Use bool which is a native type in C++ (and remove SaBoolT)
     - Write unit-test when refactoring code into units.
    +- Set up unittest framework for amfa and amfnd [#1610]
     - Reduce number of casts in the code (introduced because of C++ files)
     - Remove use of EDU and do direct encode/decode [#1544]
     - Change macros to (inline) methods
    
     
  • Hans Nordebäck

    Hans Nordebäck - 2015-11-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -21,7 +21,7 @@
     - Convert model derived C structs to classes and change functions into methods.
     - Use bool which is a native type in C++ (and remove SaBoolT)
     - Write unit-test when refactoring code into units.
    -- Set up unittest framework for amfa and amfnd [#1610]
    +- Setup unittest framework for amfa and amfnd [#1610]
     - Reduce number of casts in the code (introduced because of C++ files)
     - Remove use of EDU and do direct encode/decode [#1544]
     - Change macros to (inline) methods
    
     
  • Long H Buu Nguyen

    created #1614 amfnd: replace internal use of SaNameT with std::string.

     
  • Minh Hon Chau

    Minh Hon Chau - 2016-01-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -12,7 +12,7 @@
         - Change SU::list_of_susi and SI:: list_of_sisu to std::vector HansN
        -
     - Replace internal use of SaNameT with std::string [#1537]
    -- Use std::maps instead of Patricia trees.
    +- Use std::maps instead of Patricia trees. [#1656]
     - Reduce duplicate code.
     - Improve cyclomatic complexity (McCabe) numbers.
     - Simplify conditional statements. [#1538]
    
     
  • Minh Hon Chau

    Minh Hon Chau - 2016-01-06
     
  • Hans Nordebäck

    Hans Nordebäck - 2016-01-28

    changeset: 7264:a30247a1affb
    tag: tip
    user: Hans Nordeback hans.nordeback@ericsson.com
    date: Thu Jan 28 08:37:35 2016 +0100
    files: osaf/services/saf/amf/amfd/comp.cc osaf/services/saf/amf/amfd/include/comp.h osaf/services/saf/amf/amfd/ndfsm.cc osaf/services/saf/amf/amfd/ndproc.cc osaf/services/saf/amf/amfd/su.cc
    description:
    amfd: Add AVD_COMP global functions to AVD_COMP class [#1520]

     

    Related

    Tickets: #1520

  • Anders Widell

    Anders Widell - 2017-04-03
    • Milestone: 5.0.FC --> future
     

Log in to post a comment.