coupling_metric — Logtalk 3.100.1

object

# `coupling_metric`

Computes entity efferent coupling, afferent coupling, instability, abstractness, and distance from the main sequence.

Availability:
`logtalk_load(code_metrics(loader))`
Author: Ebrahim Azarisooreh and Paulo Moura
Version: 0:15:0
Date: 2026-03-13
Compilation flags:
`static, context_switching_calls`
Imports:
`public` code_metrics_utilities
`public` code_metric
Uses:
list
Remarks:

> - Efferent coupling (Ce): Number of entities that an entity depends on.

> - Afferent coupling (Ca): Number of entities that depend on an entity.

> - Instability (I): Computed as `Ce / (Ce + Ca)`. Measures the entity resilience to change. Ranging from 0 to 1, with 0 indicating a maximally stable entity and 1 indicating a maximally unstable entity. Ideally, an entity is either maximally stable or maximally unstable.

> - Abstractness (A): Computed as the ratio between the number of static predicates with scope directives without a local definition and the number of static predicates with scope directives. Measures the rigidity of an entity. Ranging from 0 to 1, with 0 indicating a fully concrete entity and 1 indicating a fully abstract entity.

> - Distance from main sequence (D): Computed as `abs(A + I - 1)`. Measures how far an entity is from the idealized line `A + I = 1`. Ranging from 0 to 1, with 0 indicating the entity is on the main sequence and 1 indicating it is as far as possible (either maximally abstract and stable, or maximally concrete and unstable).

> - Entity score: Represented as the compound term `ce_ca_i_a_d(Ce,Ca,I,A,D)`.

> - Dependencies count: Includes direct entity relations plus calls or dynamic updates to predicates in external objects or categories.

Inherited public predicates:
all/0 all/1 all_score/1 check_option/1 check_options/1 default_option/1 default_options/1 directory/1 directory/2 directory_score/2 entity/1 entity_score/2 file/1 file/2 file_score/2 format_entity_score//2 library/1 library/2 library_score/2 option/2 option/3 rdirectory/1 rdirectory/2 rdirectory_score/2 rlibrary/1 rlibrary/2 rlibrary_score/2 valid_option/1 valid_options/1

## Public predicates

(no local declarations; see entity ancestors if any)

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)