关于类内聚度量公式S(m,a)中int()与mod()函数的含义问询
mod() Function in the SCOM Class Cohesion Metric Let's break this down clearly, since I've worked through similar cohesion metric questions before:
First, quick context to ground us:
- SCOM is a specialized metric for measuring class cohesion in software systems.
- It's formalized in Luis Fernández and Rosalía Peña's paper A SENSITIVE METRIC OF CLASS COHESION (page 86), with this formula:
$$S(m,a) = \frac 12\left[1 + int\left(\frac {m-1}a\right)\right]\left[mod\left(\frac {m-1}a\right) + m -1\right]$$
Here:m= total number of methods in the classa= total number of attributes in the class
You're right about int()—that's definitely the integer floor division function, which grabs the whole-number quotient of $(m-1)$ divided by $a$.
As for mod()? In the context of software engineering metrics papers like this, this is almost always the modulo operation—meaning it returns the remainder left after performing integer division of $(m-1)$ by $a$.
For a quick example: if $m-1 = 7$ and $a = 3$, then $\frac{7}{3} = 2.333...$. The int() of that is 2, and the mod() is 1 (since 3*2 = 6, 7-6 = 1).
Sometimes papers use shorthand like % (common in programming) or rem for remainder, but paired with int() (which handles the quotient), there's no ambiguity here—mod() refers to the remainder from integer division.
内容的提问来源于stack exchange,提问作者George Aristy

