WEBVTT

00:00:00.500 --> 00:00:01.880
Go inside the school.

00:00:02.780 --> 00:00:04.252
Five facts came in.

00:00:05.150 --> 00:00:08.822
Enrollment and score are two sides of one record, so they share

00:00:08.835 --> 00:00:10.280
a module, the roll.

00:00:11.179 --> 00:00:15.072
That leaves four: settings, courses, students and the roll.

00:00:15.970 --> 00:00:18.926
Each module is the only code that touches its memory.

00:00:19.825 --> 00:00:21.035
Write it as a table.

00:00:21.934 --> 00:00:22.663
The fact.

00:00:23.562 --> 00:00:24.239
Its owner.

00:00:25.137 --> 00:00:25.983
Who reads it.

00:00:26.882 --> 00:00:28.679
Who may ask for it to change.

00:00:29.577 --> 00:00:30.788
One owner per row.

00:00:31.687 --> 00:00:35.059
If two modules both want to write the same fact, the design

00:00:35.072 --> 00:00:36.048
is not finished.

00:00:36.947 --> 00:00:38.809
Three of these are plain modules.

00:00:39.707 --> 00:00:42.129
The dean changes a setting and it is changed.

00:00:43.028 --> 00:00:44.187
The roll is different.

00:00:45.085 --> 00:00:48.106
An enrollment or a score is a decision someone may question

00:00:48.119 --> 00:00:51.699
later, so every accepted change to the roll goes through Rechain.

00:00:52.598 --> 00:00:54.147
The roll becomes a reducer.

00:00:55.046 --> 00:00:56.465
It still owns its memory.

00:00:57.364 --> 00:01:00.671
It gains two things: changes arrive only as actions through

00:01:00.684 --> 00:01:03.783
dispatch, and everyone else reads it through selectors.

00:01:04.681 --> 00:01:08.041
Enrolling needs students, courses and the roll at once.

00:01:08.939 --> 00:01:10.033
So we add Office.

00:01:10.931 --> 00:01:12.832
Office has functions and no memory.

00:01:13.731 --> 00:01:16.179
It reads the others and dispatches to the roll.

00:01:17.077 --> 00:01:19.890
It sits in the place the Rechain film called the thunk.

00:01:22.033 --> 00:01:23.934
Sol enrolls in course twelve.

00:01:24.834 --> 00:01:26.761
Office asks three questions.

00:01:27.660 --> 00:01:29.873
Students: is this caller a student?

00:01:30.772 --> 00:01:32.438
Yes, three-four-four.

00:01:33.337 --> 00:01:35.446
Courses: is there a course twelve?

00:01:36.345 --> 00:01:36.943
Yes.

00:01:37.842 --> 00:01:41.423
The roll's selector: is three-four-four already on course twelve?

00:01:42.321 --> 00:01:42.829
No.

00:01:43.727 --> 00:01:46.097
Office builds one action and dispatches it.

00:01:46.996 --> 00:01:49.951
The roll reducer checks the action against its own state and

00:01:49.964 --> 00:01:50.680
accepts.

00:01:51.579 --> 00:01:55.420
Its prepared change lands, and the chain gains block one-sixteen.

00:01:56.318 --> 00:01:57.490
Sol is enrolled.

00:01:59.633 --> 00:02:02.927
Ten minutes later Tov records Sol's score, ninety-one.

00:02:03.827 --> 00:02:06.692
Office asks Courses who teaches course twelve.

00:02:07.590 --> 00:02:08.463
It is Tov.

00:02:09.361 --> 00:02:11.562
Office asks Settings for the pass mark.

00:02:12.460 --> 00:02:13.111
Seventy.

00:02:14.010 --> 00:02:15.598
Here is the design decision.

00:02:16.497 --> 00:02:19.517
A reducer checks an action against its own state and nothing

00:02:19.530 --> 00:02:19.973
else.

00:02:20.872 --> 00:02:23.033
The roll cannot look inside Settings.

00:02:23.931 --> 00:02:26.627
So Office writes the pass mark into the action.

00:02:27.525 --> 00:02:28.306
Dispatch.

00:02:29.205 --> 00:02:33.228
The roll finds Sol enrolled and not yet scored, compares ninety-one

00:02:33.241 --> 00:02:34.986
with seventy, and accepts.

00:02:35.885 --> 00:02:37.056
Sol has passed.

00:02:37.955 --> 00:02:41.314
Block one-seventeen records it, pass mark included.

