Skip to content

Commit 5b7fb70

Browse files
committed
Improve desirable properties
1 parent 7725469 commit 5b7fb70

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

apps/components_guide_web/lib/components_guide_web/templates/composable_systems/desirable-properties.html.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abc
4444
- Won’t clash with existing values
4545
- *e.g. UUID (RFC 4122)*
4646
- *e.g. SHA256 hash digest (RFC 6234)*
47-
- Could still be guessable: *e.g. Auto increment SQL primary key*
47+
- Warning: could still be [guessable](#guessable): *e.g. Auto increment SQL primary key*
4848

4949
```console
5050
# UUID
@@ -59,23 +59,35 @@ abc
5959
- *e.g. UUID v4*
6060
- *e.g. Cryptographically Random source*
6161

62-
<h3 id=guessable>Guessable</h3>
62+
```console
63+
> head -c16 /dev/urandom | base64
64+
4mQ9EA==
65+
```
66+
67+
<h3 id=guessable>Undesirable: Guessable</h3>
6368

6469
- Not Secure
6570
- Not [Random](#random)
66-
- *e.g. Auto increment SQL primary key*
71+
- *e.g. Auto incrementing SQL primary key*
72+
- *e.g. The current time*
73+
74+
```console
75+
> date -u '+%Y-%m-%dT%H:%M:%SZ'
76+
2021-02-07T22:51:21Z
77+
```
6778

6879
----
6980

7081
<h2>Acts</h2>
7182

7283
<h3 id=immutable>Immutable</h3>
7384

74-
- Benefits caching
75-
- Benefits syncing
76-
- *e.g. Twitter tweets are not editable*
77-
- *e.g. a Git commit*
78-
- *e.g. a YouTube video cannot be edited*
85+
- Changes to data work on a copy, preserving the original
86+
- Benefits caching: *given I have an object’s ID, the contents will always be the same*
87+
- Benefits syncing: *retrieve only the parts I do not yet have*
88+
- *e.g. Twitter tweets cannot be edited, only deleted*
89+
- *e.g. YouTube video media cannot be edited, only deleted*
90+
- *e.g. Git object from a committed file*
7991

8092
<h3 id=stateless>Stateless</h3>
8193

@@ -84,8 +96,10 @@ abc
8496

8597
<h3 id=idempotent>Idempotent</h3>
8698

87-
- *e.g. At-least-once event delivery*
88-
- Could use Random identifier in request to record which commands have already been completed
99+
- The same effect is produced if run once, twice, or a thousand times
100+
- *e.g. Consumer of an at-least-once event delivery system*
101+
- *e.g. [Stripe charges](https://stripe.com/docs/api/idempotent_requests)*
102+
- Hint: Could generate a [random](#random) identifier for each request, which allows recording which commands have already been processed.
89103

90104
<h3 id=versioned>Versioned</h3>
91105

0 commit comments

Comments
 (0)