Skip to content
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

SAD (Multiple issues) #65

Closed
agadfs opened this issue Dec 19, 2024 · 0 comments
Closed

SAD (Multiple issues) #65

agadfs opened this issue Dec 19, 2024 · 0 comments
Labels
invalid This doesn't seem right

Comments

@agadfs
Copy link
Collaborator

agadfs commented Dec 19, 2024

In org.swt

Results of the detection of Small classes:
Threshold NMD+NAD = -1.0


-Problem: CodeSmell identified by name; does not allow distinguishing two methods with the same name but different signatures.
Replace with IEntity.


-Remove contexts.


-Most HashMap objects should be removed as they provide no value.
Replace them with Set.


-Exclude and methods from metric calculations.


-Not all code smells necessarily require:

private final HashMap values, thresholdValues;
Public interface ICodeSmell : remove the following signatures:

public HashMap<String, Double> getValues();
// TODO: TO BE REMOVED!!!
public HashMap<String, Double> getThresholdValues();
Once removed, ensure these methods are also removed from all classes implementing ICodeSmell.

final HashMap thresholdMap = new HashMap();
// TODO: Problem here: thresholds for NAD and NMD are the same
// because mapOfLargeClassesValues.put(anClass, new Double(NMD + NAD));
thresholdMap.put("NAD", new Double(this.boxPlot.getMaxBound()));
thresholdMap.put("NMD", new Double(this.boxPlot.getMaxBound()));


Define threshold values for design defect detection.
Otherwise, anti-patterns present in the code in the first version may appear in the second version as new patterns, even though this is not the case.

Conclusion:
The boxplot is misleading.
Add a class attribute to Antipattern.
Add a method:

IAntipattern getAntipattern(IClass iClass)
Write a method to compare whether two anti-patterns are identical.
Write a method to compare whether two code smells are identical.
Rewrite Differentiator without codelevelmodel, instead differentiating between anti-pattern classes.


In Codesmell.java

/**

  • Compares the specified code smell with this one for equality.
  • A code smell is considered equal to another if they involve the same class.
  • Other attributes are not compared.
  • @param the code smell to be compared
  • @return boolean: true if the specified code smell is the same as this one
    */
    public boolean equalsCodeSmell(final ICodeSmell cs)

Add to BlobDetection:
Add the detection of LowCohesionDetection + ControllerClassDetection.

Extract the methods from detect() in BlobDetection.java.


In LongMethodDetection.java

final Integer value = this.annotator.getInstructionCount(aClass.getName(), aMethod.getID());
With the following values:

aClass.getName(): javax.xml.parsers.DocumentBuilder
aMethod.getID(): isNamespaceAware()
Result:
value = null


Problem:
The boxplot gives the same value for both NAD and NMD.

Blob:
Large Class
NameClass: org.argouml.uml.diagram.collaboration.ui.UMLCollaborationDiagram
Values: {NAD=13.0, NMD=9.0}
Threshold: {NAD=13.0, NMD=13.0}

Data Class
NameClass: org.argouml.uml.diagram.ui.ActionAddAssociationRole
Values: {NAD=1.0, NMD=1.0}

Blob:
Data Class
NameClass: org.apache.xerces.validators.common.InsertableElementsInfo
Values: {NAD=8.0, NMD=1.0}

Large Class
NameClass: org.apache.xerces.validators.common.DFAContentModel
Values: {NAD=22.0, NMD=13.0}
Threshold: {NAD=23.0, NMD=23.0}

Moreover, getHigherValues does not work!

@agadfs agadfs changed the title SAD (Multiple issues) SAD Dec 19, 2024
@agadfs agadfs changed the title (Multiple issues) SAD SAD (Multiple issues) Dec 19, 2024
@agadfs agadfs added the invalid This doesn't seem right label Jan 16, 2025
@agadfs agadfs closed this as completed Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant