The Number Of Tokens (NOT) is a complexity metrics, computed is defined as the total number of language lexical tokens that are in the unit. For example, consider this famous starter program of the C programming language:
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
The program comprises of the following tokens: 2 identifiers (printf
and main
, one string literal (0
), two keywords (int
and return
), two semicolons, two pairs of parenthesis and one pair of curly brackets. The total token complexity of the program is therefore 14 (ignoring pre-processor directives).
Spartan programming dictates that software unit should be simplified to as to minimize their token count complexity, while suggesting specific techniques for doing so, including: