object

# halstead_metric(Stroud)

> Computes Halstead complexity numbers for an entity.

> - `Stroud` – Coeficient for computing the time required to program.

author:
  `Paulo Moura`
version:
  `0.6`
date:
  `2018/6/9`

compilation flags:
  `static, context_switching_calls`

imports:
  `public code_metrics_utilities`
  `public code_metric`

## Public interface

(see related entities)

## Protected interface

(see related entities)

## Private predicates

(see related entities)

## Operators

### (none)

## Remarks

Definition of operators
  Predicates declared, user-defined, and called are interpreted as operators. Built-in predicates and built-in control constructs are ignored.

Definition of operands
  Predicate arguments are abstracted and interpreted as operands. Note that this definition of operands is a significant deviation from the original definition, which used syntactic literals.

Pn
  Number of distinct predicates (declared, defined, or called)

PAn
  Number of predicate arguments (assumed distinct)

Cn
  Number of predicate calls + number of clauses

CAn
  Number of predicate call arguments + number of clause head arguments

EV
  Entity vocabulary: EV = Pn + PAn

EL
  Entity length: EL = Cn + CAn

V
  Volume: V = EL * log2(EV)

D
  Difficulty: D = (Pn/2) * (CAn/An)

E
  Effort: E = D * V

T
  Time required to program: T = E/k seconds (k is the Stroud number; defaults to 18)

B
  Number of delivered bugs: B = V/3000

Entity score
  Represented as the compound term pn_pan_cn_can_ev_el_v_d_e_t_b/11.

## See also

### (none)