Walking at the Edge — A Naturally-Oriented and Practical Design
The design offers natural orientation and practical safety by following two simple rules:
by Mansour Ayouni · in the repository since 2025-04-15 · design essay · area Collections & objects
The stzWalker class introduces a subtle but powerful principle: Walking at the Edge. This principle governs how the walker behaves when a step would take it outside the permitted walkable range. Instead of arbitrary constraints, this design provides a consistent, intuitive behavior based on directional logic, user intent, and natural flow.
Natural Orientation
- Going before the start → ❌ Raises an error
- Going beyond the end → ✅ Silently ignored
In other terms:
- The walker is conscious of its direction: starting from the
Startposition and moving towards theEnd. - Any step that tries to go before the Start position is treated as a breach of the boundary, thus raising an error.
- In contrast, if a step goes beyond the End position, the walker ignores it silently — because we’ve reached the natural edge of the walk.
This mirrors how we walk in the physical world. You stop walking backward if you hit a wall (error), but you can look ahead into the horizon and simply stop when the road ends (no error).
Practical Behavior
- Errors are raised only when the walker tries to go somewhere it should never go — before its departure point.
- Silent ignores are used when steps go beyond the destination, making the walker robust and forgiving to overly-optimistic steps.
- This minimizes interruptions during iteration, making it easy to handle dynamic steps without needing excessive guard conditions.
Flexible Variants
- Whether walking with a single step or multiple cyclic steps, the walker behaves consistently:
- Valid steps are used and respected.
- Steps that breach the "before start" limit raise errors.
- Steps that go after the destination are simply skipped.
- The walker continues processing valid steps in the list as long as they maintain the walk within the allowed range.
This adaptive behavior allows the user to define step patterns without micromanaging them.
Example Summary
| Expression | Behavior |
|---|---|
Wk(3, 10, 12) |
No walkable positions; silent (no error) |
Wk(3, 5, -5) |
❌ Error: step goes before start |
Wk(3, 10, [12, 3]) |
12 is ignored, 3 is used |
Wk(3, 10, [3, 12]) |
12 is ignored; walker continues |
Wk(3, 10, [2, -1, 3]) |
Valid walkable series with backward steps |
Wk(3, 10, [2, -7, 3]) |
❌ Error due to -7 moving before start |
Wk(10, 3, 2) |
Walker moves backward; valid walk |
Wk(10, 20, [-5, 2]) |
Accepts mixed directions until limit |
Expressive Error Messages
When a walker tries to step before the Start, it raises an error — but not just any error. It provides a clear and human-readable sentence that shows exactly what went wrong and how we got there.
Example:
Wk(10, 50, [1, -2, 10, -5])
illustration
This raises:
> Can't initiate the walker!Trying to walk on position `9` in the path `[10, 11, 9]` after applying these steps `[1, -2, 10, -5]`.
The walker simulates the path before failing, so you know:
- Where it started
- Which steps were applied
- Where it broke the rules
This makes debugging much easier, especially with cyclic or complex step patterns.
More Visual Examples
Great! Let's enhance the explanation with a visual timeline that illustrates how the stzWalker behaves at the edge, according to your design principles.
The Timeline
We illustrate behavior with horizontal timelines. Let’s say:
Wk(3, 10, [3, 12]) # Timeline: 3 4 5 6 7 8 9 10 │───┬───┬───┬───┬───┬───┬───│ ↑ ↑ ↑ │ │ └─── Step 3 → 6, then 6+12=18 ❌ skipped │ └──────────── Step 3 → 6 └─────────────────── Start position
illustration
Walkables → [3, 6, 9]
Explanation: 3 → +3 → 6 → +3 → 9 → +3 = 12 ❌ out of range → skipped.
Example with Cyclic Steps
Wk(3, 10, [2, -1]) 3 4 5 6 7 8 9 10 │───┬───┬───┬───┬───┬───┬───│ ↑ ↑ ↑ ↑ ↑ │ │ │ │ └─── Backward -1 from 10 → 9 │ │ │ └─────── Forward 2 from 7 → 9 │ │ └─────────── Backward -1 from 6 → 5 │ └─────────────── Forward 2 from 4 → 6 └─────────────────── Start position
illustration
Walkables → [3, 5, 4, 6, 5, 7, 6, 8, 7, 9]... (bounded, stops before overflow)
Forbidden Entry Before Start
Wk(3, 10, -1) # Timeline: 3 4 5 6 7 8 9 10 │───┬───┬───┬───┬───┬───┬───│ ↑ ✖ │ └─── Attempt to walk -1 from 3 → 2 ❌ ERROR! └──────── Start position
illustration
Error → "Step would go before the start boundary"
Mixed Case: Ignore After End
Wk(3, 10, [3, 12]) # Timeline: 3 4 5 6 7 8 9 10 │───┬───┬───┬───┬───┬───┬───│ ↑ ↑ ↑ │ │ └─── Step 3 → 6, next step 12 → 18 ❌ skipped │ └──────────── Step 3 → 6 └─────────────────── Start
illustration
The timeline reveals: - ✅ You stay within bounds - ❌ Any attempt to walk past start = error - 💤 Attempts to walk beyond the end = ignored silently
Benefits of This Edge-Walking Design
| 🌱 Natural-Oriented | 🧰 Practical | 🎯 Flexible |
|---|---|---|
| Reflects real-world logic | Prevents silent bugs | Accepts variant steps |
| Forward/backward symmetry | Clear errors at edges | Cyclic step pattern |
| Start and end are sacred | Avoids infinite walks | Combines directions |
Final Thoughts
The Walking at the Edge model is a hallmark of user-centered, logic-consistent design. It avoids unnecessary constraints while preserving logical safety. This balance makes the stzWalker not only easy to use, but also a tool that "walks" like a human would think — attentive, adaptive, and smartly cautious.
Cite
Mansour Ayouni. "Walking at the Edge — A Naturally-Oriented and Practical Design". Softanza narrations, 2025. https://mayouni.github.io/stzsite/en/narrations/stzwalker-walking-at-the-edge-narration.html
Not run: its code does not load as written. The article is published as written; its blocks are illustrations. The code of the articles is Haro code. Where an article was written before the language took its present name, the name was changed and nothing else. Genre, area and series read from the file's name, the year from its first commit: derived, until the article carries its own header. The file on GitHub(opens in a new tab)

