HackerTube 中文?
Software boundaries and change →

Can one record tell you both now and then?

Two reads disagree. First ask which moment each value describes, then who can change it. Keeping history and coordinating writes solve different problems.

Questions in this reading · 7
  1. What did the record say at the time?
  2. Can a later update invalidate an earlier fact?
  3. What does a snapshot promise its reader?
  4. Why does shared mutable state tangle a program?
  5. Does hiding mutation remove coordination costs?
  6. Who coordinates access to the same record?
  7. Why don’t two locked objects make a safe transaction?

What did the record say at the time?

Access patterns determine how to organize a store. Retaining historical facts determines which past questions it will ever be able to answer.

Compare original passages and timestamps · 2
understand every access pattern I need to know
AWS re:Invent 2018: Amazon DynamoDB Deep Dive: Advanced Design Patterns for DynamoDB (DAT401) · ▶ 27:59–28:05
no they don't because facts incorporate time how is
The Value of Values with Rich Hickey · ▶ 20:30–20:41

Can a later update invalidate an earlier fact?

State makes an answer depend on when you ask. Recording time with a fact lets two different answers describe different moments without contradicting each other.

Compare original passages and timestamps · 2
Having state in your program is never simple, right?
"Simple Made Easy" - Rich Hickey (2011) · ▶ 36:01–36:08
no they don't because facts incorporate time how is
The Value of Values with Rich Hickey · ▶ 20:30–20:41

What does a snapshot promise its reader?

Stable snapshots let observers read a particular version. Treating information as values explains why that version can be passed on without changing its meaning.

Compare original passages and timestamps · 2
key characteristic of a value is that it's immutable
Are We There Yet - Rich Hickey · ▶ 24:48–24:53
values are immutable right and values are semantically transparent
The Value of Values with Rich Hickey · ▶ 10:43–10:54

Why does shared mutable state tangle a program?

One talk separates identity from its successive values. The other shows how state couples parts of a system through time. Read them together to identify what a caller must know about earlier operations.

Compare original passages and timestamps · 2
key characteristic of a value is that it's immutable
Are We There Yet - Rich Hickey · ▶ 24:48–24:53
Having state in your program is never simple, right?
"Simple Made Easy" - Rich Hickey (2011) · ▶ 36:01–36:08

Does hiding mutation remove coordination costs?

An object can conceal its state and still require callers to coordinate operations. Examine what happens when independently safe operations must work together.

Compare original passages and timestamps · 2
They hide mutation – they mutate some state inside, right?
Category Theory 1.1: Motivation and Philosophy · ▶ 10:48–10:57
feels like an immutable object, except that it has state inside it.
How To Design A Good API and Why it Matters · ▶ 41:10–41:16

Who coordinates access to the same record?

Designing a table around queries addresses how data is laid out. Routing operations to one process addresses how simultaneous work on a record is coordinated.

Compare original passages and timestamps · 2
access on a single record is going through a single process
Erlang Factory 2014 - That's 'Billion' with a 'B': Scaling to the Next Level at WhatsApp · ▶ 14:38–14:43
understand every access pattern I need to know
AWS re:Invent 2018: Amazon DynamoDB Deep Dive: Advanced Design Patterns for DynamoDB (DAT401) · ▶ 27:59–28:05

Why don’t two locked objects make a safe transaction?

Compare what each lock protects with what the combined operation requires. This is a cost of coordinating shared mutable state, not a claim that every lock is wrong.

Compare original passages and timestamps · 3
values aggregate to values all the benefits apply to Aggregates
The Value of Values with Rich Hickey · ▶ 16:07–16:16
and unfortunately locks don't compose either, right. That's the problem with locks.
Category Theory 1.1: Motivation and Philosophy · ▶ 12:16–12:26
as soon as you have objects being shared encapsulation just flies out the window
Object-Oriented Programming is Bad · ▶ 20:59–21:10

Try it on your own example

If two requests update one account, what can a reader see, and can you recover the previous value later?