.. index:: coupling_metric
.. _coupling_metric/0:

.. rst-class:: right

**object**

``coupling_metric``
===================

Computes entity efferent coupling, afferent coupling, and instability.

| **Availability:** 
|    ``logtalk_load(code_metrics(loader))``

| **Author:** Ebrahim Azarisooreh and Paulo Moura
| **Version:** 0:14:0
| **Date:** 2024-03-27

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`code_metrics_utilities <code_metrics_utilities/0>`
|    ``public`` :ref:`code_metric <code_metric/0>`
| **Uses:**
|    :ref:`list <list/0>`

| **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.
   - Entity score: Represented as the compound term ``ce_ca_i_a(Ce,Ca,I,A)``.
   - Dependencies count: Includes direct entity relations plus calls or dynamic updates to predicates in external objects or categories.

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

.. contents::
   :local:
   :backlinks: top

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)

