Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refactoring : Extract method getBackboneAtomArray changes to reduce the cyclomatic complexity#1058

Merged
josemduarte merged 4 commits into
biojava:masterbiojava/biojava:masterfrom
xcalibur91:masterxcalibur91/biojava:masterCopy head branch name to clipboard
Apr 6, 2023
Merged

Refactoring : Extract method getBackboneAtomArray changes to reduce the cyclomatic complexity#1058
josemduarte merged 4 commits into
biojava:masterbiojava/biojava:masterfrom
xcalibur91:masterxcalibur91/biojava:masterCopy head branch name to clipboard

Conversation

@xcalibur91

Copy link
Copy Markdown

The method getBackboneAtomArray had a cyclomatic complexity of 22, hence refactored the method was to optimize the code.
This refactoring can be qualified as extract method refactoring.
The logic and the output after refactoring remain the same.

Sreejith Nair added 3 commits April 4, 2023 21:38

@josemduarte josemduarte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! nice improvements. See one comment below.


List<Atom> atoms = new ArrayList<>();
Set<String> nucleotideAtomNames = new HashSet<>(Arrays.asList(C1_ATOM_NAME, C2_ATOM_NAME, C3_ATOM_NAME, C4_ATOM_NAME, O2_ATOM_NAME, O3_ATOM_NAME, O4_ATOM_NAME, O5_ATOM_NAME, OP1_ATOM_NAME, OP2_ATOM_NAME, P_ATOM_NAME));
Set<String> aminoAcidAtomNames = new HashSet<>(Arrays.asList(CA_ATOM_NAME, C_ATOM_NAME, N_ATOM_NAME, O_ATOM_NAME));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd propose to extract these 2 as constants on top of this class with names NUCLEOTIDE_BACKBONE_ATOMS and AMINOACID_BACKBONE_ATOMS

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'll get it done

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have done the needful.

@xcalibur91 xcalibur91 requested a review from josemduarte April 6, 2023 06:24

@josemduarte josemduarte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@josemduarte josemduarte merged commit 27a5799 into biojava:master Apr 6, 2023
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.