panic icon indicating copy to clipboard operation
panic copied to clipboard

Investigation: Spot code related improvements in the Channels Manager source code

Open dillu24 opened this issue 3 years ago • 0 comments

Rationale

In this ticket we should go through the Channels Manager source code to spot areas that can be re-written in a better way. Such code improvements may include the following:

  1. Decomposing complex/long logic into granular functions
  2. Decomposing large if clauses into functions for better readability
  3. Investigate whether we can use some already established design patterns that can improve the code-base
  4. Make variable names more readable where necessary
  5. Remove code duplication where necessary (meaning we should abstract out functionality that is commonly being done across functions/classes)

Points 1 and 2 above will enable us to write more granular, effective and readable unit tests. Therefore, after completing the refactoring we should visit the unit tests and perform the following:

  1. Each unit test must be designed in such a way that it tests out a specific requirement of the component
  2. Each unit test should be granular and checks one specific case. If more related cases are to be tested, we should use parameterized.expand
  3. We should not add unit tests just for code-coverage.
  4. We should create variables that are used in many setUp functions inside the test-utils folder. This will enable us to have shorter test scripts and remove code duplication.

For ticket closure

We must create a ticket for every type of improvement we aim to do.

dillu24 avatar Jun 01 '22 10:06 dillu24