# Why it is built this way

> The decisions that give the framework its shape, each with the reason behind it and the check that keeps it true.

Source: https://omardev29.github.io/rmp-docs/framework/why/index.html

A framework is mostly decisions, and a decision you cannot see the reason for looks like an accident. These pages give the reasons: why a menu is three calls, why a hook starts with an underscore, why nothing throws, why every struct of options is ordered the way it is. Each one is a rule the framework holds itself to, and most of them are checked by a tool rather than remembered.

## The rule above the others

[The three-function menu](https://omardev29.github.io/rmp-docs/framework/why/the-three-function-menu.html). The API has to be as simple as possible for the person making the game, and a main menu written in three calls is the measure. Every other decision on these pages is answerable to it.

## How the code reads

[Naming](https://omardev29.github.io/rmp-docs/guidelines/naming.html)

One spelling per kind of name, so a type, a value and a constant never look alike where they are used, and no prefix carries meaning a dot can carry better. It is a rule of style, so it lives with the rest of the style guide, in the Guidelines.

[The access rule](https://omardev29.github.io/rmp-docs/framework/why/the-access-rule.html)

`_name` is a method of yours the framework calls; `on_name` is a function you hand to it. Two spellings, two directions.

[Designated initialisers](https://omardev29.github.io/rmp-docs/framework/why/designated-initialisers.html)

Why options are written `{ .speed = 320 }`, why the order of the fields matters, and why a behavior has no base class.

[Macros](https://omardev29.github.io/rmp-docs/framework/why/macros.html)

Where a macro is the right tool — the entry point, the values from the `.toml` — and the one rule about them: a header never makes you use one.

## How the framework holds together

[One header per module](https://omardev29.github.io/rmp-docs/framework/why/one-header-per-module.html)

No umbrella header, headers that do not include each other, and the cost of every include measured rather than guessed.

[Ownership](https://omardev29.github.io/rmp-docs/framework/why/ownership.html)

Everything is owned by something that releases it: a texture, an object, a scene, a callback. No raw pointer in the API, nothing you have to free, and the handle for what you keep across frames.

[No exceptions](https://omardev29.github.io/rmp-docs/framework/why/no-exceptions.html)

What the framework does instead of throwing, and why throwing in the middle of a frame is not an option.

[Time is a parameter](https://omardev29.github.io/rmp-docs/framework/why/delta-and-time.html)

Why every hook is handed `delta`, where the clock is read, and what `[app] max_delta` protects you from.

## Checked, not remembered

A rule written only in a document is kept until the day someone has not read it. So wherever a mistake can be described precisely, something in the framework's own checks rejects it — a check of clang-tidy, a stage of [`rmp test`](https://omardev29.github.io/rmp-docs/reference/commands.html#test), clang-format or the compiler. [The Guidelines](https://omardev29.github.io/rmp-docs/guidelines/index.html#checked) list every one of those rules with the tool that holds it, and where: in the framework, in its examples and in a game.
