This page builds — from nothing — every word and symbol the parent note SRP topic assumes you already know: class, module, actor, reason to change, coupling, and the small pieces of probability (p, A, 1−p, the power (1−p)A−1). Do not skip: even if a word feels familiar, we anchor it to a picture so the rest of the topic clicks.
Before we can say "a class should have one reason to change," we must agree on what a class is.
Data (fields): the facts it remembers, e.g. an employee's name, hoursWorked, rate.
Methods (actions): things it can do, e.g. calculatePay(), save().
Look at the figure: the outer rectangle is the class box. The top drawer holds fields (facts); the bottom drawer holds methods (verbs). Everything SRP talks about is which methods belong in the same box.
The parent note's entire definition rests on this phrase, so we earn it carefully.
Picture a class box with arrows pointing into it. Each arrow is a person (or role) who might one day say "change this behaviour." If one arrow points in, the box has one reason to change. If two arrows point in, it has two.
Left box (good): one arrow — one reason to change.
Right box (bad): two arrows from two different roles — two reasons to change. When Accounting pulls its arrow, the shared code moves and HR's arrow gets yanked too.
The word "actor" is just a tidy label for "the boss behind an arrow." SRP restated with this vocabulary:
We need the word actor because "reason to change" is abstract, but an actor is a concrete person you can point at on an org chart. That is why the topic keeps saying "which stakeholder asks for this change?"
If the shaded part p means "breaks," the unshaded part is "does not break." The whole bar is 1, so:
We use 1−p (called the survival probability) because it is easier to ask "did everything survive?" than "did at least one break?" — the survivals multiply cleanly, as we see next.
Suppose two other actors each independently survive a change with probability 1−p. "Both survive" is like flipping two coins and asking for two heads. For independent events, you multiply the chances:
The figure shows a probability tree: each fork splits into "survive" (1−p) and "break" (p). Follow the top-top branch (all survive) — you multiply along the path, giving (1−p)2 for two actors.
When one actor makes the request, there are A−1other actors who might get broken. All must survive, so we multiply (1−p) by itself A−1 times. Writing "(1−p) multiplied A−1 times" as a power is just shorthand:
Now the parent's formula reads itself:
R(A)=whole bar1−everyone else survives(1−p)A−1=P(at least one other actor breaks)
Also note DRY Principle (Don't Repeat Yourself): sharing a helper to avoid duplication is good — unless the helper is shared by two actors, which secretly re-couples them. That is the trap in the parent's regularHours() example.