Note: Thinking about code in a algorithmic way.

Author: Amlal El Mahrouss (amlal@ne-app.eu)

Published September 16, 2026

Contents

When you want to understand how an algorithm works, think of it mathematically. That is, go step by step, define invariants, establish predicates, and so on.

Think of it as a set of predicates to be either fulfilled or not. And then the reasoning shall be cleaner.

Examples

Have a look at systemd's DBus implementation: https://github.com/systemd/systemd/blob/main/src/core/dbus.c. And apply the methodology laid out previously. This will greatly help understanding the code.

#cpp #computerscience