@hobin/developer 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -372
- package/REFERENCE_ROUTING.md +243 -0
- package/extensions/developer.ts +533 -18
- package/extensions/machine.ts +45 -0
- package/extensions/references/behavior-preserving-structural-change.md +87 -8
- package/extensions/skills.ts +330 -52
- package/extensions/state.ts +227 -2
- package/package.json +9 -3
- package/skills/abstraction-review/SKILL.md +37 -23
- package/skills/abstraction-review/reference-policy.json +66 -0
- package/skills/abstraction-review/references/field-card.md +113 -168
- package/skills/abstraction-review/references/repair-table.md +66 -80
- package/skills/abstraction-review/references/worked-examples.md +79 -256
- package/skills/model/SKILL.md +31 -13
- package/skills/model/reference-policy.json +96 -0
- package/skills/model/references/contract-and-replacement-models.md +112 -0
- package/skills/model/references/logic-query-semantics.md +89 -0
- package/skills/model/references/planning-models.md +75 -0
- package/skills/model/references/problem-modeling.md +143 -276
- package/skills/model/references/proof-obligations.md +71 -0
- package/skills/model/references/relational-constraint-models.md +110 -0
- package/skills/model/references/solver-result-boundaries.md +83 -0
- package/skills/model/references/temporal-behavior-models.md +106 -0
- package/skills/naming-judgment/SKILL.md +17 -4
- package/skills/naming-judgment/reference-policy.json +29 -0
- package/skills/naming-judgment/references/domain-naming.md +29 -10
- package/skills/schedule/SKILL.md +16 -6
- package/skills/schedule/reference-policy.json +29 -0
- package/skills/schedule/references/structural-change-timing.md +81 -18
- package/skills/signal/SKILL.md +17 -6
- package/skills/signal/reference-policy.json +29 -0
- package/skills/signal/references/structural-movement.md +87 -14
- package/skills/sketch/SKILL.md +38 -42
- package/skills/sketch/reference-policy.json +212 -0
- package/skills/sketch/references/accumulator-invariants.md +125 -0
- package/skills/sketch/references/closure-and-conventional-interfaces.md +87 -0
- package/skills/sketch/references/composition-by-wishes.md +69 -0
- package/skills/sketch/references/data-driven-design.md +99 -22
- package/skills/sketch/references/data-shape-template-catalog.md +58 -19
- package/skills/sketch/references/design-levels-and-boundaries.md +133 -0
- package/skills/sketch/references/earned-abstraction.md +75 -0
- package/skills/sketch/references/generative-recursion.md +122 -0
- package/skills/sketch/references/generic-dispatch-systems.md +75 -0
- package/skills/sketch/references/language-semantics.md +82 -0
- package/skills/sketch/references/meaning-preserving-conversions.md +69 -0
- package/skills/sketch/references/process-shape-and-resources.md +157 -0
- package/skills/sketch/references/representation-barriers.md +73 -0
- package/skills/sketch/references/responsibility-and-collaboration.md +108 -0
- package/skills/sketch/references/runtime-and-compilation.md +84 -0
- package/skills/sketch/references/selection-and-creation.md +76 -0
- package/skills/sketch/references/state-history-and-order.md +126 -0
- package/skills/sketch/references/type-transitions.md +54 -0
- package/skills/sketch/references/variation-roles.md +59 -0
- package/skills/verify/SKILL.md +17 -6
- package/skills/verify/reference-policy.json +30 -0
- package/skills/verify/references/verifier-selection-and-pass-but-wrong.md +152 -192
- package/SOURCES.md +0 -104
- package/skills/abstraction-review/references/recipe-cards.md +0 -322
- package/skills/model/references/worked-models-and-specialized-techniques.md +0 -218
- package/skills/sketch/references/abstraction-barriers-and-closure.md +0 -160
- package/skills/sketch/references/abstraction-composition-and-state.md +0 -184
- package/skills/sketch/references/composition-generative-recursion-and-accumulators.md +0 -196
- package/skills/sketch/references/generic-operations-and-languages.md +0 -134
- package/skills/sketch/references/processes-state-and-time.md +0 -171
- package/skills/sketch/references/responsibility-and-variation.md +0 -245
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Generative Recursion
|
|
2
|
+
|
|
3
|
+
Use this reference when the algorithm creates a new instance of the problem
|
|
4
|
+
rather than following an immediate self-reference in the data definition.
|
|
5
|
+
|
|
6
|
+
## Structural Or Generated
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
structural call:
|
|
10
|
+
consumes a field selected directly from one data clause
|
|
11
|
+
|
|
12
|
+
generative call:
|
|
13
|
+
computes a new problem instance from domain or algorithm knowledge
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
A generated problem may happen to be a suffix or subinterval. What matters is
|
|
17
|
+
why it exists. Misclassifying it as structural hides both the algorithm idea and
|
|
18
|
+
its progress obligation.
|
|
19
|
+
|
|
20
|
+
## Generative Design Spine
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
trivial: which instances have direct answers?
|
|
24
|
+
solve: what are those answers?
|
|
25
|
+
generate: how are next subproblems produced?
|
|
26
|
+
preserve: why do their solutions contribute to this problem?
|
|
27
|
+
combine: how are recursive answers and current facts assembled?
|
|
28
|
+
progress: what well-founded measure decreases on every branch?
|
|
29
|
+
failure: how are no-solution, exhausted search, error, and divergence distinct?
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
A preserving relation supports result correctness. A decreasing measure supports
|
|
33
|
+
termination. Neither implies the other.
|
|
34
|
+
|
|
35
|
+
## Process Trace
|
|
36
|
+
|
|
37
|
+
For binary search, record generated intervals rather than only input/output:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
[0, 6] -> [4, 6] -> [4, 4] -> Found(4)
|
|
41
|
+
[0, 0] -> [1, 0] -> NotFound
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The measure `high - low + 1` decreases for every non-trivial call. The accepted
|
|
45
|
+
domain must also establish finite ordered bounds, valid indexing, and discrete
|
|
46
|
+
midpoint progress.
|
|
47
|
+
|
|
48
|
+
For every generated branch include:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
original problem
|
|
52
|
+
generation result
|
|
53
|
+
preserved relation
|
|
54
|
+
next measure
|
|
55
|
+
branch result and combination
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Machine, Numeric, Random, And Search Progress
|
|
59
|
+
|
|
60
|
+
Mathematical decrease can fail on a machine. State:
|
|
61
|
+
|
|
62
|
+
- exact versus inexact representation;
|
|
63
|
+
- rounding, overflow, underflow, and non-finite values;
|
|
64
|
+
- midpoint or update stagnation;
|
|
65
|
+
- tolerance meaning and iteration bounds;
|
|
66
|
+
- universal versus almost-sure termination for randomized progress;
|
|
67
|
+
- branch order, backtracking point, and visited-set scope for search.
|
|
68
|
+
|
|
69
|
+
Backtracking needs explicit failure and choice policy. Divergence in one branch is
|
|
70
|
+
not failure that permits the next candidate. Path-local, frontier, and global
|
|
71
|
+
visited sets preserve different meanings.
|
|
72
|
+
|
|
73
|
+
## Composition Boundary
|
|
74
|
+
|
|
75
|
+
A generative driver may use structurally recursive helpers. Do not label the
|
|
76
|
+
whole program generative or structural when collaborators have different process
|
|
77
|
+
obligations. Keep each helper's data recipe and the driver's generation recipe
|
|
78
|
+
separate.
|
|
79
|
+
|
|
80
|
+
## Artifact
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
Problem domain and trivial instances:
|
|
84
|
+
Generation rule:
|
|
85
|
+
Preservation relation:
|
|
86
|
+
Combination rule:
|
|
87
|
+
Well-founded measure by branch:
|
|
88
|
+
Representative generated traces:
|
|
89
|
+
Machine/numeric/random progress limits:
|
|
90
|
+
Failure, exhaustion, error, and divergence:
|
|
91
|
+
Search order and visited scope, if relevant:
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Stop And Separation
|
|
95
|
+
|
|
96
|
+
Stop when every recursive branch has a generated-instance explanation, a
|
|
97
|
+
preservation argument, and a progress or explicit divergence boundary.
|
|
98
|
+
|
|
99
|
+
Use `accumulator-invariant` when the main issue is remembered traversal knowledge,
|
|
100
|
+
the `model` logic-query route when answer/search policy is unresolved, and
|
|
101
|
+
`process-shape-and-resources` when the algorithm is accepted but stack, work, or
|
|
102
|
+
storage behavior needs a design surface.
|
|
103
|
+
|
|
104
|
+
## Source Trace
|
|
105
|
+
|
|
106
|
+
- Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram
|
|
107
|
+
Krishnamurthi, *How to Design Programs*, living build 9.2.0.3:
|
|
108
|
+
Chapter 25,
|
|
109
|
+
Chapter 26,
|
|
110
|
+
Chapter 27,
|
|
111
|
+
Chapter 28,
|
|
112
|
+
Chapter 29,
|
|
113
|
+
and Chapter 30
|
|
114
|
+
for generated problems, preservation, termination, numerics, and backtracking;
|
|
115
|
+
and Intermezzo 4
|
|
116
|
+
for exact/inexact arithmetic and machine limits.
|
|
117
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
118
|
+
Interpretation of Computer Programs*, Second Edition:
|
|
119
|
+
Section 1.2
|
|
120
|
+
for generated process shape and resource growth; and
|
|
121
|
+
Section 4.3
|
|
122
|
+
for explicit choice, failure, rollback, and search-order pressure.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Generic Dispatch Systems
|
|
2
|
+
|
|
3
|
+
Use this reference when accepted representations must coexist additively through
|
|
4
|
+
operations whose selection should not expose representation fields to callers.
|
|
5
|
+
|
|
6
|
+
## Two Axes Before Mechanism
|
|
7
|
+
|
|
8
|
+
| Representation | `charge` | `refund` | `describe` |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| Card | supported | supported | supported |
|
|
11
|
+
| Bank transfer | supported | unsupported | supported |
|
|
12
|
+
| Store credit | supported | supported | supported |
|
|
13
|
+
|
|
14
|
+
Distinguish representation growth (row) from operation growth (column). Classes,
|
|
15
|
+
visitors, multimethods, tables, and registries distribute those costs differently.
|
|
16
|
+
Select from observed growth pressure.
|
|
17
|
+
|
|
18
|
+
## Dispatch Ownership
|
|
19
|
+
|
|
20
|
+
State:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
dispatch key and operation key
|
|
24
|
+
who registers or enumerates variants
|
|
25
|
+
duplicate and overlap policy
|
|
26
|
+
precedence and load order
|
|
27
|
+
unsupported capability result
|
|
28
|
+
visibility and failure timing
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Moving branches into registration data relocates precedence ownership; it does
|
|
32
|
+
not remove it. A local exhaustive conditional is often the smaller owner for a
|
|
33
|
+
few closed variants.
|
|
34
|
+
|
|
35
|
+
## Extension Check
|
|
36
|
+
|
|
37
|
+
Add a fake row and one new column. Existing callers and old variant modules should
|
|
38
|
+
remain unchanged only along the axis the design claims to support. A registry adds
|
|
39
|
+
startup, naming, reflection, deployment, duplicate, and failure obligations.
|
|
40
|
+
|
|
41
|
+
## Artifact
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Variant-operation matrix:
|
|
45
|
+
Observed growth axis:
|
|
46
|
+
Representation barrier:
|
|
47
|
+
Dispatch and registration owner:
|
|
48
|
+
Duplicate, overlap, precedence, load-order, and unsupported policy:
|
|
49
|
+
Fake-row and new-column checks:
|
|
50
|
+
Simpler conditional alternative:
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Stop And Separation
|
|
54
|
+
|
|
55
|
+
Stop when both axes and all dispatch policies are visible and the chosen mechanism
|
|
56
|
+
is no more powerful than current extension pressure requires.
|
|
57
|
+
|
|
58
|
+
Use `meaning-preserving-conversions` only when operations cross representation
|
|
59
|
+
worlds, the variation-role or selection-creation route when domain role/creation
|
|
60
|
+
ownership is primary, and `language-semantics` when registered data becomes
|
|
61
|
+
executable notation.
|
|
62
|
+
|
|
63
|
+
## Source Trace
|
|
64
|
+
|
|
65
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
66
|
+
Interpretation of Computer Programs*, Second Edition,
|
|
67
|
+
Section 2.4
|
|
68
|
+
and Section 2.5
|
|
69
|
+
for generic operations, data-directed dispatch, and extension axes.
|
|
70
|
+
- Zachary Tellman, *Elements of Clojure*, Leanpub 2019-02-11, Indirection,
|
|
71
|
+
public-manuscript pp. 64-69, for ordered conditionals, table conflicts, and
|
|
72
|
+
qualified openness cost.
|
|
73
|
+
- Sandi Metz et al., *99 Bottles of OOP*, Second Edition, v2.2.2, Chapters 6-7,
|
|
74
|
+
pp. 155-187, calibrates role and factory pressure without making registration a
|
|
75
|
+
universal destination.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Language Semantics
|
|
2
|
+
|
|
3
|
+
Use this reference when ordinary data and functions have become notation that
|
|
4
|
+
needs its own grammar, validation, evaluation, result, and error semantics.
|
|
5
|
+
|
|
6
|
+
## Language Gate
|
|
7
|
+
|
|
8
|
+
A configuration, rule table, query, expression, or workflow is a language only
|
|
9
|
+
when it needs an owned account of:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
primitives
|
|
13
|
+
combination
|
|
14
|
+
abstraction or reusable names
|
|
15
|
+
accepted grammar and validation
|
|
16
|
+
evaluation in an environment
|
|
17
|
+
errors and unsupported programs
|
|
18
|
+
evolution and compatibility
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Prefer typed data plus ordinary functions when they keep policy more visible.
|
|
22
|
+
|
|
23
|
+
## Representation, Parsing, And Meaning
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
transport input
|
|
27
|
+
-> accepted grammar or sublanguage
|
|
28
|
+
-> constructed semantic representation
|
|
29
|
+
-> evaluator meaning
|
|
30
|
+
-> rendered or effectful result
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Represent inspectable notation as semantic data rather than string positions.
|
|
34
|
+
Constructors may simplify only under explicit semantic laws. Parse success does
|
|
35
|
+
not establish evaluator meaning.
|
|
36
|
+
|
|
37
|
+
## Evaluator Contract
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
evaluate : Program x Environment x ExecutionPolicy -> Evaluation
|
|
41
|
+
Evaluation = One(Result) | Search(Stream<Result>) | LanguageError
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
State scope, binding, order, demand, zero/one/many results, answer/proof identity,
|
|
45
|
+
duplicates, choice/fairness, branch failure, error, divergence, rollback, effects,
|
|
46
|
+
negation, cancellation, termination, and resource limits as applicable. A
|
|
47
|
+
mathematically equivalent rewrite may change any of these observers.
|
|
48
|
+
|
|
49
|
+
## Artifact
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
Language gate and ordinary-data alternative:
|
|
53
|
+
Primitives, combinations, and abstractions:
|
|
54
|
+
Grammar and semantic representation:
|
|
55
|
+
Validation and invalid programs:
|
|
56
|
+
Evaluator/result/search contract:
|
|
57
|
+
Scope, order, demand, multiplicity, effects, failure, and termination:
|
|
58
|
+
Example program and unsupported case:
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Stop And Separation
|
|
62
|
+
|
|
63
|
+
Stop when a representative and invalid program have explainable syntax, meaning,
|
|
64
|
+
result shape, effects, and failure, and the ordinary-data alternative was
|
|
65
|
+
considered.
|
|
66
|
+
|
|
67
|
+
Use `runtime-and-compilation` only when lowering, calling convention, generated
|
|
68
|
+
code, roots, or optimization guards are independently consequential. Return to
|
|
69
|
+
`model/logic-query-semantics` when search meaning is not yet accepted.
|
|
70
|
+
|
|
71
|
+
## Source Trace
|
|
72
|
+
|
|
73
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
74
|
+
Interpretation of Computer Programs*, Second Edition:
|
|
75
|
+
Section 4.1,
|
|
76
|
+
Section 4.2,
|
|
77
|
+
Section 4.3,
|
|
78
|
+
and Section 4.4
|
|
79
|
+
for evaluator models, laziness, nondeterminism, and relational semantics.
|
|
80
|
+
- Hillel Wayne, *Logic for Programmers*, v0.14.0, Chapters 11-12, pp. 139-168,
|
|
81
|
+
calibrates solver/query language result multiplicity and search boundaries;
|
|
82
|
+
recorded beta defects are excluded.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Meaning-Preserving Conversions
|
|
2
|
+
|
|
3
|
+
Use this reference when values from different representation worlds must
|
|
4
|
+
participate in one operation without silently losing domain meaning.
|
|
5
|
+
|
|
6
|
+
## Draw Paths
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
Integer -> Rational -> Decimal
|
|
10
|
+
Money(USD) -X-> Money(EUR) without exchange context
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For each edge state:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
source and target meaning
|
|
17
|
+
operation that requires the path
|
|
18
|
+
precision, identity, order, metadata, or capability preserved
|
|
19
|
+
ability lost
|
|
20
|
+
ambiguous alternate paths
|
|
21
|
+
cycle and termination policy
|
|
22
|
+
unsupported result
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
A path through representations is not evidence that the conversion is meaningful.
|
|
26
|
+
Choose direct operation, coercion, canonical form, explicit context, or rejection.
|
|
27
|
+
|
|
28
|
+
## Path Selection
|
|
29
|
+
|
|
30
|
+
Prefer a path only when:
|
|
31
|
+
|
|
32
|
+
- every edge preserves the observer required by the operation;
|
|
33
|
+
- alternate paths do not produce ambiguous meaning;
|
|
34
|
+
- repeated conversion terminates and does not accumulate hidden loss beyond the
|
|
35
|
+
contract;
|
|
36
|
+
- unsupported combinations fail visibly;
|
|
37
|
+
- the canonical form, if any, does not erase a needed source distinction.
|
|
38
|
+
|
|
39
|
+
## Artifact
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
Source worlds and target operation:
|
|
43
|
+
Conversion graph:
|
|
44
|
+
Preserved observer by edge:
|
|
45
|
+
Lost ability by edge:
|
|
46
|
+
Ambiguous paths and precedence:
|
|
47
|
+
Cycle/termination policy:
|
|
48
|
+
Direct/canonical/context/reject decision:
|
|
49
|
+
Unsupported and round-trip checks:
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Stop And Separation
|
|
53
|
+
|
|
54
|
+
Stop when every legal path has an explicit preserved observer and loss note, and
|
|
55
|
+
unsupported or ambiguous paths are rejected or owned by policy.
|
|
56
|
+
|
|
57
|
+
Return to `model/contract-replacement` when preserved meaning itself is disputed.
|
|
58
|
+
Use `generic-dispatch-systems` when additive operation selection is independently
|
|
59
|
+
required.
|
|
60
|
+
|
|
61
|
+
## Source Trace
|
|
62
|
+
|
|
63
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
64
|
+
Interpretation of Computer Programs*, Second Edition,
|
|
65
|
+
Section 2.5
|
|
66
|
+
for coercion, type towers, ambiguity, and representation interactions.
|
|
67
|
+
- Hillel Wayne, *Logic for Programmers*, v0.14.0, Chapter 5, pp. 47-60,
|
|
68
|
+
calibrates observer-relative replacement; conversion-graph and production
|
|
69
|
+
compatibility artifacts are Developer synthesis.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Process Shape And Resources
|
|
2
|
+
|
|
3
|
+
Use this reference when returned values do not describe the generated work,
|
|
4
|
+
control, waits, capacity, lifetime, or effect boundary of a design.
|
|
5
|
+
|
|
6
|
+
## Procedure Is Not Process
|
|
7
|
+
|
|
8
|
+
Trace representative execution:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
procedure: retry(operation, 3)
|
|
12
|
+
process:
|
|
13
|
+
attempt 1 -> retryable failure -> wait 100 ms
|
|
14
|
+
attempt 2 -> retryable failure -> wait 200 ms
|
|
15
|
+
attempt 3 -> success
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Record:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
work generated at each step
|
|
22
|
+
control owner and continuation
|
|
23
|
+
deferred work or stack growth
|
|
24
|
+
shared and retained data
|
|
25
|
+
active and paused execution
|
|
26
|
+
input shortage/overload behavior
|
|
27
|
+
time/space bounds
|
|
28
|
+
failure and cancellation surface
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Short source text is not evidence of a simple process. A fluent pipeline may
|
|
32
|
+
materialize several collections; recursive syntax may generate constant-space or
|
|
33
|
+
growing-stack execution depending on continuation placement.
|
|
34
|
+
|
|
35
|
+
## Active, Paused, And Capacity Boundaries
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
data scope:
|
|
39
|
+
initial values, shared references, acquired input, new sharing edges
|
|
40
|
+
active execution:
|
|
41
|
+
locally ordered operations while progress is possible
|
|
42
|
+
paused execution:
|
|
43
|
+
external signal, resource, or capacity required
|
|
44
|
+
input excess:
|
|
45
|
+
ignore, reject, bound, queue, shed, or backpressure
|
|
46
|
+
input shortage:
|
|
47
|
+
wait, timeout, retry/back off, fail, or report
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A thread-safe queue coordinates access; it does not prove bounded waiting,
|
|
51
|
+
starvation freedom, capacity, or independent understandability. Name the owner
|
|
52
|
+
and finite bound before claiming isolation.
|
|
53
|
+
|
|
54
|
+
## Control, Tail Position, And Retention
|
|
55
|
+
|
|
56
|
+
At every nested step state:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
what must happen after return
|
|
60
|
+
values live across the call
|
|
61
|
+
what may be clobbered
|
|
62
|
+
what is saved and where
|
|
63
|
+
maximum nesting and overflow policy
|
|
64
|
+
error/cancellation transfer
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A call is in tail position only when the current computation has no deferred work
|
|
68
|
+
that requires a return frame. Verify stack and control claims with stack depth,
|
|
69
|
+
operation count, allocation, retained graph, or an adversarial bounded trace—not
|
|
70
|
+
with result equality alone.
|
|
71
|
+
|
|
72
|
+
For memory-sensitive work identify roots, reachable objects, release events,
|
|
73
|
+
external handles, identity rules, capacity, and out-of-memory behavior. Garbage
|
|
74
|
+
collection cannot repair an unintended root, cache, callback, stream prefix, or
|
|
75
|
+
unclosed handle.
|
|
76
|
+
|
|
77
|
+
## Pull, Transform, Push
|
|
78
|
+
|
|
79
|
+
Use this phase split only when it matches failure and ownership:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
pull:
|
|
83
|
+
acquire and bound external information; own invalid/unavailable behavior
|
|
84
|
+
transform:
|
|
85
|
+
compute a context-light domain result
|
|
86
|
+
push:
|
|
87
|
+
interpret effect data; own idempotency and partial failure
|
|
88
|
+
apex:
|
|
89
|
+
coordinate the whole outcome at the last responsible moment
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If pull returns a lazy effectful producer, the pull owner must enclose
|
|
93
|
+
consumption, resource closure, retry, truncation, and decoding. Prefer inspectable
|
|
94
|
+
effect data until push. Reject this split when one atomic transaction or shared
|
|
95
|
+
invariant is the real boundary.
|
|
96
|
+
|
|
97
|
+
## Task Completion And Acknowledgment
|
|
98
|
+
|
|
99
|
+
For work crossing processes, distinguish message delivery from completed task:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
task identity and entry command
|
|
103
|
+
effect boundary where outcome becomes uncertain
|
|
104
|
+
completion acknowledgment and failure meaning
|
|
105
|
+
outstanding-work owner and durable state
|
|
106
|
+
retry owner, duplicate policy, cancellation, and stop
|
|
107
|
+
intermediate release point
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
An edge-held outstanding-task record is an ownership candidate, not an
|
|
111
|
+
exactly-once guarantee. Distributed durability and recovery require separate
|
|
112
|
+
protocol evidence.
|
|
113
|
+
|
|
114
|
+
## Artifact
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
Procedure promise and representative process trace:
|
|
118
|
+
Generated work and continuation owner:
|
|
119
|
+
Shared data and new sharing edges:
|
|
120
|
+
Active/paused dependencies:
|
|
121
|
+
Too-much/too-little policy:
|
|
122
|
+
Stack, queue, time, space, and retention bounds:
|
|
123
|
+
Roots, identity, handles, and release:
|
|
124
|
+
Pull/transform/push ownership, if applicable:
|
|
125
|
+
Task acknowledgment and outstanding-work owner:
|
|
126
|
+
Failure, retry, duplicate, cancellation, and residual risk:
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Stop And Separation
|
|
130
|
+
|
|
131
|
+
Stop when work, control, wait, capacity, lifetime, failure, and completion are
|
|
132
|
+
owned and bounded enough to make the first implementation step honest.
|
|
133
|
+
|
|
134
|
+
Use `state-history-and-order` when previous interactions or event ordering define
|
|
135
|
+
meaning, and `runtime-and-compilation` when these obligations belong to an
|
|
136
|
+
interpreter/compiler convention rather than an ordinary process.
|
|
137
|
+
|
|
138
|
+
## Source Trace
|
|
139
|
+
|
|
140
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
141
|
+
Interpretation of Computer Programs*, Second Edition:
|
|
142
|
+
Section 1.2
|
|
143
|
+
for process shape and resource growth;
|
|
144
|
+
Section 5.1
|
|
145
|
+
for control, continuations, registers, and stacks;
|
|
146
|
+
Section 5.2.4
|
|
147
|
+
for process instrumentation;
|
|
148
|
+
Section 5.3
|
|
149
|
+
for reachability, roots, identity, and storage reclamation; and
|
|
150
|
+
Section 5.4.2
|
|
151
|
+
for tail calls and retained frames.
|
|
152
|
+
- Zachary Tellman, *Elements of Clojure*, Leanpub 2019-02-11:
|
|
153
|
+
Composition, public-manuscript pp. 98-119, for partial data/execution isolation,
|
|
154
|
+
waiting, overload, pull-transform-push, effectful lazy input, topology, and task
|
|
155
|
+
acknowledgment.
|
|
156
|
+
- Complete production cancellation, recovery, capacity, and delivery protocols
|
|
157
|
+
remain Developer adaptations.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Representation Barriers
|
|
2
|
+
|
|
3
|
+
Use this reference after [Design Levels And Boundaries](design-levels-and-boundaries.md)
|
|
4
|
+
when one accepted domain value needs public operations and laws that hide a
|
|
5
|
+
consequential representation choice.
|
|
6
|
+
|
|
7
|
+
## Build The Barrier
|
|
8
|
+
|
|
9
|
+
1. Name the domain value and interpretation.
|
|
10
|
+
2. List only supported constructors, selectors, predicates, and domain
|
|
11
|
+
operations.
|
|
12
|
+
3. State laws callers may rely on.
|
|
13
|
+
4. Identify the one owner of validation, normalization, and simplification.
|
|
14
|
+
5. Write two materially different representations.
|
|
15
|
+
6. Rewrite one real caller using only public vocabulary.
|
|
16
|
+
7. Search for representation primitives outside the owner.
|
|
17
|
+
|
|
18
|
+
Do not expose a field alias merely because the representation contains the field.
|
|
19
|
+
Public operations come from caller purposes and stable laws.
|
|
20
|
+
|
|
21
|
+
## Worked Shape
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Rate = conversion relationship between two quantities
|
|
25
|
+
|
|
26
|
+
makeRate(numerator, denominator)
|
|
27
|
+
numeratorOf(rate)
|
|
28
|
+
denominatorOf(rate)
|
|
29
|
+
multiplyRate(left, right)
|
|
30
|
+
|
|
31
|
+
law: denominatorOf(makeRate(n, d)) > 0
|
|
32
|
+
law: Rate(1, 2) and Rate(2, 4) have equal domain meaning
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Representation A normalizes at creation. Representation B stores raw terms and
|
|
36
|
+
normalizes at observation. `multiplyRate` and callers must not change. The
|
|
37
|
+
barrier preserves freedom about representation and normalization time.
|
|
38
|
+
|
|
39
|
+
## Artifact
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
Domain meaning and caller purposes:
|
|
43
|
+
Public operations and laws:
|
|
44
|
+
Invariant/normalization owner:
|
|
45
|
+
Representations A and B:
|
|
46
|
+
Real caller rewritten:
|
|
47
|
+
Replacement check:
|
|
48
|
+
Leak search:
|
|
49
|
+
Unsupported raw access:
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Stop And Separation
|
|
53
|
+
|
|
54
|
+
Stop when a materially different representation changes only the owner and
|
|
55
|
+
adapters, one real caller uses only domain vocabulary, and leak search finds no
|
|
56
|
+
raw primitives.
|
|
57
|
+
|
|
58
|
+
Reject when no choice is hidden, callers still require layout, or operations are
|
|
59
|
+
only field aliases with no stable law. Use `closure-and-conventional-interfaces`
|
|
60
|
+
when composition of values is the independent question.
|
|
61
|
+
|
|
62
|
+
## Source Trace
|
|
63
|
+
|
|
64
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
65
|
+
Interpretation of Computer Programs*, Second Edition,
|
|
66
|
+
Section 2.1
|
|
67
|
+
for data abstraction, selectors/constructors, laws, and representation
|
|
68
|
+
independence.
|
|
69
|
+
- Matthias Felleisen et al., *How to Design Programs*, living build 9.2.0.3,
|
|
70
|
+
Chapter 22
|
|
71
|
+
for accessors over alternate positional encodings.
|
|
72
|
+
- Replacement and repository leak-search artifacts are Developer adaptations of
|
|
73
|
+
those barriers.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Responsibility And Collaboration
|
|
2
|
+
|
|
3
|
+
Use this reference when a real accepted change exposes misplaced knowledge,
|
|
4
|
+
repeated arguments, data clumps, feature envy, navigation leaks, or uncertainty
|
|
5
|
+
about which participant should own a decision.
|
|
6
|
+
|
|
7
|
+
## Begin With Change Pressure
|
|
8
|
+
|
|
9
|
+
State the accepted change and where the current arrangement resists it. A smell
|
|
10
|
+
locates a point of attack; it does not select a class, service, or pattern.
|
|
11
|
+
|
|
12
|
+
Inventory what each current unit:
|
|
13
|
+
|
|
14
|
+
- knows;
|
|
15
|
+
- calculates or decides;
|
|
16
|
+
- coordinates;
|
|
17
|
+
- creates;
|
|
18
|
+
- sends to collaborators;
|
|
19
|
+
- changes for independent reasons.
|
|
20
|
+
|
|
21
|
+
Write wished messages in domain language. Repeatedly pulling data from one unit
|
|
22
|
+
so another can interpret it is evidence of misplaced responsibility.
|
|
23
|
+
|
|
24
|
+
## Candidate Owner
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
responsibility and reason to change
|
|
28
|
+
knowledge or history required
|
|
29
|
+
minimal caller messages
|
|
30
|
+
hidden context callers stop knowing
|
|
31
|
+
creation/selection owner
|
|
32
|
+
representative accepted change
|
|
33
|
+
rejected old placement
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
A credible unit groups behavior with the knowledge needed to answer its messages.
|
|
37
|
+
Reject moved-method bags, generic services, and pass-through interfaces with no
|
|
38
|
+
independent participant or change pressure.
|
|
39
|
+
|
|
40
|
+
## Participant And Environment Boundary
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
environment and participants
|
|
44
|
+
represented and ignored facts
|
|
45
|
+
interface sense
|
|
46
|
+
assumptions and drift signal
|
|
47
|
+
independent purposes/deployments/replacement cycles
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A cohesive component may share assumptions internally. Strong interfaces belong
|
|
51
|
+
between independently evolving participants. Public boundaries calcify, so mature
|
|
52
|
+
them locally when both sides co-evolve.
|
|
53
|
+
|
|
54
|
+
## Navigation And Dependency
|
|
55
|
+
|
|
56
|
+
A message chain is problematic when intermediate results cross collaborator API
|
|
57
|
+
boundaries and expose structure. Chain length alone is not the criterion.
|
|
58
|
+
Forwarding can reduce direct coupling as an intermediate move, but a
|
|
59
|
+
structure-shaped forwarding name is not completed responsibility movement.
|
|
60
|
+
|
|
61
|
+
Depend on the stable role a caller actually uses. Do not inject unrelated objects
|
|
62
|
+
merely to make every unit configurable.
|
|
63
|
+
|
|
64
|
+
## Tests As Responsibility Evidence
|
|
65
|
+
|
|
66
|
+
Prefer focused evidence for stable public responsibility and integration evidence
|
|
67
|
+
for collaboration/creation. A tiny collaborator may be covered through its
|
|
68
|
+
owner only when it is simple, invisible elsewhere, and has no independent
|
|
69
|
+
context. Fakes preserve the role while removing irrelevant context; tests that
|
|
70
|
+
echo private calls inhibit redesign.
|
|
71
|
+
|
|
72
|
+
## Artifact
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
Accepted change pressure:
|
|
76
|
+
Current responsibility inventory:
|
|
77
|
+
Point of attack:
|
|
78
|
+
Wished messages:
|
|
79
|
+
Candidate owner, knowledge, contract, and hidden context:
|
|
80
|
+
Participant environment, assumptions, and replacement cycles:
|
|
81
|
+
Navigation/dependency boundary:
|
|
82
|
+
Representative change and rejected placement:
|
|
83
|
+
Responsibility and collaboration checks:
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Stop And Separation
|
|
87
|
+
|
|
88
|
+
Stop when the representative change becomes local to one coherent owner and
|
|
89
|
+
callers use meaningful messages without unrelated context or participant leaks.
|
|
90
|
+
|
|
91
|
+
Use `variation-roles-and-transitions` when several implementations must share a
|
|
92
|
+
caller contract, and `selection-and-creation` when choosing or constructing a
|
|
93
|
+
variant is independently unresolved. Route a concrete candidate to
|
|
94
|
+
`abstraction-review`; do not approve it here.
|
|
95
|
+
|
|
96
|
+
## Source Trace
|
|
97
|
+
|
|
98
|
+
- Sandi Metz, Katrina Owen, and TJ Stankus, *99 Bottles of OOP*, Second Edition,
|
|
99
|
+
v2.2.2, Chapters 3-5 and 8-9, pp. 51-154 and 188-268, for change pressure,
|
|
100
|
+
responsibility extraction, messages, argument movement, dependency direction,
|
|
101
|
+
API-aware Demeter judgment, forwarding, and responsibility-focused tests.
|
|
102
|
+
- Zachary Tellman, *Elements of Clojure*, Leanpub 2019-02-11:
|
|
103
|
+
Indirection, public-manuscript pp. 70-95, for environment/model/interface/
|
|
104
|
+
assumptions, principled components, participant pressure, and calcification.
|
|
105
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
106
|
+
Interpretation of Computer Programs*, Second Edition,
|
|
107
|
+
Section 2.1
|
|
108
|
+
calibrates hidden representation and operation ownership.
|