X Tutup
Skip to content

Fix: refactor implementation and design smells#1088

Closed
cassandrabeaton wants to merge 1 commit intobiojava:masterfrom
cassandrabeaton:master
Closed

Fix: refactor implementation and design smells#1088
cassandrabeaton wants to merge 1 commit intobiojava:masterfrom
cassandrabeaton:master

Conversation

@cassandrabeaton
Copy link
Copy Markdown

This is a fix for several code smells discovered in the code.

  1. Complex method in TranscriptSequence (Fix: Extracted helper method and removed duplication)
  2. Complex conditional in AtomPositionMap (Fix: Decomposed conditionals)
  3. Long statement in GroupContactSet (Fix: Added explaining variables)
  4. Insufficient modularization in SubunitCluster (Fix: Extracted a new class)
  5. Feature envy in StructureInterface (Fix: moved method to Pair class)
  6. Cyclically-dependent modularization in PdbPairXMLConverter (Fix: changed dependency to unidirectional)

Tests are passing for all fixes. Test class TestSubunitClusterMerge was created for the new extracted class mentioned in #4.

Copy link
Copy Markdown
Contributor

@josemduarte josemduarte left a comment

Choose a reason for hiding this comment

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

Thanks. Please see some comments below

// Use structural alignment to match the subunit clusters
if (c1.get(i).mergeStructure(c2.get(j),cParams)) {
SubunitClusterMerge subunitClusterMerge = new SubunitClusterMerge(c1.get(i));
if (subunitClusterMerge.mergeStructure(c2.get(j),cParams)) {
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.

In my opinion it was more readable before, as you could see the i/j merging in a single line. Would you have a strong reason for this change?

public PdbPairsMessage(){

method = PdbPairXMLConverter.DEFAULT_METHOD_NAME;
method = FatCatRigid.algorithmName;
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 think it was intended to point to DEFAULT_METHOD_NAME. Then there's a constant that's specific for the default.

SubunitClusterMerge subunitClusterMerge = new SubunitClusterMerge(clusters.get(c1));
if (params.isUseEntityIdForSeqIdentityDetermination() &&
clusters.get(c1).mergeIdenticalByEntityId(clusters.get(c2))) {
subunitClusterMerge.mergeIdenticalByEntityId(clusters.get(c2))) {
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 would have the same comment here as above. I don't see this improves readability. And same for a few other cases below.

* i.e. it is between symmetry-related molecules (with same chain identifier)
* @return
*/
public boolean isSymRelated() {
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.

The Pair class is general and intended for any kind of pair (note the generic type T). This would break that generality.

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

X Tutup