Skip to content

Performed refactoring of generatePalette function by doing extracting method.#2448

Open
Sim-CAD wants to merge 3 commits into
gephi:masterfrom
Sim-CAD:master
Open

Performed refactoring of generatePalette function by doing extracting method.#2448
Sim-CAD wants to merge 3 commits into
gephi:masterfrom
Sim-CAD:master

Conversation

@Sim-CAD

@Sim-CAD Sim-CAD commented Mar 25, 2022

Copy link
Copy Markdown

generatePalette function has 3 problems:

  1. It is a complex method where Cyclomatic complexity is 29,
  2. There are duplicate blocks of code and
  3. It is a long method with lines of code equals to 110.
    Two new methods are created after this refactorization process which is collectColorSamples and getClosestColorSamples.

After refactoring the cyclomatic complexity got reduced to 16.

Sim-CAD added 2 commits March 24, 2022 21:21
This function has 3 problems:
1) It is a complex method where Cyclomatic complexity is 29, 2) There are duplicate blocks of code and 3) It is a long method with lines of code equals to 110.
Two new methods are created after this refactorization process which is collectColorSamples and getClosestColorSamples.
…ngNodeSizeTransformer and RankingLabelSizeTransformer extended class RankingSizeTransformer. In both child classes, they are implementing the same isNode method with the same implementation. As it is promoting duplicate code, it is always better to put the duplicate code in the parent class so that all other classes that uses this parent class can utilize this method without re-writing it.
@Sim-CAD

Sim-CAD commented Mar 25, 2022

Copy link
Copy Markdown
Author

Hi

FYI, I am currently working on the refactoring of codes and my university work.

Thanks
Smriti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant