Coder Social home page Coder Social logo

Questions and analyze about jpeek HOT 5 OPEN

cqfn avatar cqfn commented on July 22, 2024
Questions and analyze

from jpeek.

Comments (5)

0crat avatar 0crat commented on July 22, 2024

@yegor256 please, pay attention to this issue

from jpeek.

sergey-karazhenets avatar sergey-karazhenets commented on July 22, 2024

I've created pull request #54 for show a bug with generic methods. Pull request relates only for CAMC metric, but if we are going to fix it I will add test for all metrics. Let's see what was happened in tests for class OverrideGenericMethodFromInterface. Accoding to our current implemented logic we expect in test that CAMC will be calculated as:

l = 2 (two distinct types: int, java.lang.Integer)
k = 2 (methods: construnctor, inc())
a = 1 (type: int) + 1 (type: java.lang.Integer) = 2

CAMC = a / (l * k) = 2 / (2 * 2) = 2 / 4 = 0.5000

But result was 0.3333. It was happend because we counted synthetic methods. See point 4 with a bytecode that copiler produces. According to that bytecode we calculate:

l = 3 (three distinct types: int, java.lang.Integer, java.lang.Object)
k = 3 (methods: construnctor, inc(), synthetic inc())
a = 1 (type: int) + 1 (type: java.lang.Integer) + 1 (type: java.lang.Object) = 3

CAMC = a / (l * k) = 3 / (3 * 3) = 3 / 9 = 0.3333

I will fix that if we will decide that is wrong behaviour or you can just close pull request without merging and without any fixes.

from jpeek.

yegor256 avatar yegor256 commented on July 22, 2024

@sergey-karazhenets for CAMC:

  1. So, am I right that we should count only parameter types of method for l?

Yes, totally agree.

  1. So, should we consider simple types and theirs analogous boxed types as the same types or consider them as different types (like compiler does)?

I think we should treat Integer and int as one type. I think that we should introduce a new class which will do exactly that -- fetch the list of types from a method signature. And it has to explicitly say in its Javadoc how do we understand the differences between types. This should not be a decision for CAMC metric only, but for the entire product. Make sense?

  1. So, is it correct that we consider constructors as methods?

I think we should not consider constructors as methods. Let's try to find some papers that confirm that. Again, let's create a class that will fetch all methods from a class. Let's use it everywhere in all metrics, to make this decision universal for the entire product.

  1. Should we consider only public methods or consider all methods (public, private, protected, package-private)? I think we should consider all methods, but what do you think?

I would say we pay attention only to public methods.

I will fix that if we will decide that is wrong behaviour or you can just close pull request without merging and without any fixes.

I agree with the fix introduced.

from jpeek.

yegor256 avatar yegor256 commented on July 22, 2024

@sergey-karazhenets once again, let's not forget that there are many metrics. Let's try to make all changes apply to all metrics. Try to introduce new classes, instead of making changes to specific metrics.

from jpeek.

yegor256 avatar yegor256 commented on July 22, 2024

@sergey-karazhenets can you please split this ticket to a few separate tickets? Now it's difficult to track the progress.

from jpeek.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.