Brutal Software

Brutal:
Plain and direct, without worrying about anyone's feelings.

We have feelings! Reality is brutal; it is our task to embrace it.

Picture of Martin

Naming

Identifier naming is a solved problem. Brutality embraces the cultural difficulties of adoption, and fights for what's right.

  1. Ensure lexeme usage is ubiquitous across code and domain.
  2. CamelCase lexemes, allow established initialisms, forbid word clipping.
  3. Order lexemes by increasing specificity, separated by underscores.
  4. Maximize specificity and precision by exhausting available information.
  5. Specify qualifiers and units (unless unitless).

This maximizes semantic clarity, yields taxonomic clustering upon lexicographic ordering, preserves correspondence with domain ontology, and eliminates polysemy, homonymy, and ambiguity. That's a terse mouthful with precise meaning. Look up words you don't know!

/* This is just an example, please avoid hardcoding this sort of information! */
enum {
	Audio_Render_Channel_Count = 2,
	Audio_Render_SampleRate_Hertz = 48000,
	Audio_Render_NyquistFrequency_Hertz = Audio_Render_SampleRate_Hertz / 2,
	Audio_Render_Quantum_Size_F32Count = 128,
	Audio_Synthesizer_Voice_Frequency_Hertz_Max = Audio_Render_NyquistFrequency_Hertz,
};
			
Lexeme:
A unit of meaning in a language, consisting of a word or group of words, the elements of which do not separately convey the meaning of the whole.
Ubiquitous:
Existing or being everywhere at the same time.
Initialism:
An abbreviation formed from initial letters, like OS, CLI, or HTML.
Clipping (morphology):
The formation of a new word by shortening it, like ptr, idx, or arg.

Useful Structures

/* NOTE: Verify all sizes for your platform, because the C standard avoids standardization by design! */

typedef unsigned int U32;
typedef unsigned long long U64;

struct Allocation_64Bit {
	void *Base_Address;
	U64 Size_Reserved_Bytes;
	U64 Size_Committed_Bytes;
	U64 Size_Used_Bytes;
};

struct IndexRange_32Bit {
	U32 Offset;
	U32 Count;
};