-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring : Extract method getBackboneAtomArray changes to reduce the cyclomatic complexity #1058
Conversation
…ity of getBackboneAtomArray
…rlapScore method to eliminate complex conditional smell
…te complex conditional smell
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have done the needful.
…nd AMINOACID_BACKBONE_ATOMS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
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.