Skip to content

LCOM4 realization issue #519

@iMaks99

Description

@iMaks99

Referring to “Class Cohesion Metrics for Software Engineering: A Critical Review” by Habib Izadkhah, Maryam Hooshyar, that noted as a resource that they used during development, we can discover that LCOM4 counts number of directly or indirectly connected components. This definition excludes possibility of having negative results, however, jPeek returns a noticeable number of negative results. This is the reason why we consider LCOM4 results as unreliable. LCOM4 expands the area of connections between two methods by adding internal calls of one method inside another as an indirect connection. It would probably lead to performance improvement in classes without attributes. As an example, this class has 4 methods, 1 attribute and 6 pairs. jPeek returned -0.6667 value.

package ma.glasnost.orika.test.generics;
 
import java.util.Objects;
 
public abstract class GenericCollectionsTestCase$Person {
    private String name;
 
    public GenericCollectionsTestCase$Person() { }
 
    public String getName() {
        return this.name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public boolean equals(Object that) {
        return Objects.equals(this.name, ((GenericCollectionsTestCase$Person)that).name);
    }
 
    public int hashCode() {
        return Objects.hash(new Object[]{this.name});
    }
} 

It is possible because of normalization were made, but its unclear why result is negative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions