You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于类内聚度量公式S(m,a)中int()与mod()函数的含义问询

Clarifying the 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 class
    • a = 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:21:31