From 9f778f5b8f81fe61b7ec53629b1e23832b1038f1 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 10:52:06 +0900
Subject: [PATCH 01/12] Refactor sidebar page assignments for English and
Japanese to improve clarity and maintainability
---
_includes/manuals/1.0/en/contents.html | 6 ++++--
_includes/manuals/1.0/ja/contents.html | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/_includes/manuals/1.0/en/contents.html b/_includes/manuals/1.0/en/contents.html
index e3930fa..77626a0 100644
--- a/_includes/manuals/1.0/en/contents.html
+++ b/_includes/manuals/1.0/en/contents.html
@@ -16,14 +16,16 @@
- {% assign sidebar_pages = site.pages | get_sidebar_pages: 'en' %}
- {% for item in sidebar_pages %}
+ {% assign en_pages = site.pages | where: "layout", "docs-en" | where: "category", "Manual" | sort: "path" %}
+ {% for item in en_pages %}
+ {% unless item.path contains "/index.md" or item.path contains "/convention/" %}
{% assign item_link = item.permalink | default: item.url %}
-
{{ item.title | escape }}
+ {% endunless %}
{% endfor %}
diff --git a/_includes/manuals/1.0/ja/contents.html b/_includes/manuals/1.0/ja/contents.html
index 707221b..7588b88 100644
--- a/_includes/manuals/1.0/ja/contents.html
+++ b/_includes/manuals/1.0/ja/contents.html
@@ -16,14 +16,16 @@
- {% assign sidebar_pages = site.pages | get_sidebar_pages: 'ja' %}
- {% for item in sidebar_pages %}
+ {% assign ja_pages = site.pages | where: "layout", "docs-ja" | where: "category", "Manual" | sort: "path" %}
+ {% for item in ja_pages %}
+ {% unless item.path contains "/index.md" or item.path contains "/convention/" %}
{% assign item_link = item.permalink | default: item.url %}
-
{{ item.title | escape }}
+ {% endunless %}
{% endfor %}
From c33989cab1e6333d74641480bbd4204ca4a74413 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 11:19:00 +0900
Subject: [PATCH 02/12] Fix language separation in navigation for GitHub Pages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add explicit path-based filtering to ensure each language
navigation only shows pages from its respective language directory.
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
_includes/manuals/1.0/en/contents.html | 7 ++++++-
_includes/manuals/1.0/ja/contents.html | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/_includes/manuals/1.0/en/contents.html b/_includes/manuals/1.0/en/contents.html
index 77626a0..949b92f 100644
--- a/_includes/manuals/1.0/en/contents.html
+++ b/_includes/manuals/1.0/en/contents.html
@@ -16,15 +16,20 @@
- {% assign en_pages = site.pages | where: "layout", "docs-en" | where: "category", "Manual" | sort: "path" %}
+ {% assign all_pages = site.pages | where: "category", "Manual" %}
+ {% assign en_pages = all_pages | where: "layout", "docs-en" %}
{% for item in en_pages %}
{% unless item.path contains "/index.md" or item.path contains "/convention/" %}
+ {% unless item.path contains "/ja/" %}
+ {% if item.path contains "/en/" %}
{% assign item_link = item.permalink | default: item.url %}
-
{{ item.title | escape }}
+ {% endif %}
+ {% endunless %}
{% endunless %}
{% endfor %}
diff --git a/_includes/manuals/1.0/ja/contents.html b/_includes/manuals/1.0/ja/contents.html
index 7588b88..96f6f14 100644
--- a/_includes/manuals/1.0/ja/contents.html
+++ b/_includes/manuals/1.0/ja/contents.html
@@ -16,15 +16,20 @@
- {% assign ja_pages = site.pages | where: "layout", "docs-ja" | where: "category", "Manual" | sort: "path" %}
+ {% assign all_pages = site.pages | where: "category", "Manual" %}
+ {% assign ja_pages = all_pages | where: "layout", "docs-ja" %}
{% for item in ja_pages %}
{% unless item.path contains "/index.md" or item.path contains "/convention/" %}
+ {% unless item.path contains "/en/" %}
+ {% if item.path contains "/ja/" %}
{% assign item_link = item.permalink | default: item.url %}
-
{{ item.title | escape }}
+ {% endif %}
+ {% endunless %}
{% endunless %}
{% endfor %}
From a72dfb3d230f3d8bd8b7b8e7c4c496d34c0c930e Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 11:30:25 +0900
Subject: [PATCH 03/12] Implement robust language separation for GitHub Pages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Replace plugin dependency with pure Jekyll filters:
- Explicit path-based filtering (/ja/ vs /en/)
- Works identically in local and GitHub Pages environments
- Eliminates mixed language navigation issues
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
_includes/manuals/1.0/en/contents.html | 13 +++++--------
_includes/manuals/1.0/ja/contents.html | 13 +++++--------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/_includes/manuals/1.0/en/contents.html b/_includes/manuals/1.0/en/contents.html
index 949b92f..8b7dbfc 100644
--- a/_includes/manuals/1.0/en/contents.html
+++ b/_includes/manuals/1.0/en/contents.html
@@ -16,12 +16,10 @@
- {% assign all_pages = site.pages | where: "category", "Manual" %}
- {% assign en_pages = all_pages | where: "layout", "docs-en" %}
- {% for item in en_pages %}
- {% unless item.path contains "/index.md" or item.path contains "/convention/" %}
- {% unless item.path contains "/ja/" %}
- {% if item.path contains "/en/" %}
+ {% assign manual_pages = site.pages | where: "category", "Manual" | where: "layout", "docs-en" | sort: "path" %}
+ {% for item in manual_pages %}
+ {% unless item.path contains "/index.md" or item.path contains "/convention/" or item.path contains "/ja/" %}
+ {% if item.path contains "/en/" and item.title %}
{% assign item_link = item.permalink | default: item.url %}
-
{% endif %}
{% endunless %}
- {% endunless %}
{% endfor %}
-
+
\ No newline at end of file
diff --git a/_includes/manuals/1.0/ja/contents.html b/_includes/manuals/1.0/ja/contents.html
index 96f6f14..85bc93d 100644
--- a/_includes/manuals/1.0/ja/contents.html
+++ b/_includes/manuals/1.0/ja/contents.html
@@ -16,12 +16,10 @@
- {% assign all_pages = site.pages | where: "category", "Manual" %}
- {% assign ja_pages = all_pages | where: "layout", "docs-ja" %}
- {% for item in ja_pages %}
- {% unless item.path contains "/index.md" or item.path contains "/convention/" %}
- {% unless item.path contains "/en/" %}
- {% if item.path contains "/ja/" %}
+ {% assign manual_pages = site.pages | where: "category", "Manual" | where: "layout", "docs-ja" | sort: "path" %}
+ {% for item in manual_pages %}
+ {% unless item.path contains "/index.md" or item.path contains "/convention/" or item.path contains "/en/" %}
+ {% if item.path contains "/ja/" and item.title %}
{% assign item_link = item.permalink | default: item.url %}
-
{% endif %}
{% endunless %}
- {% endunless %}
{% endfor %}
-
+
\ No newline at end of file
From ac40a3b99e04bcd1ae95b5c505da5b96df56f4fa Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 11:41:18 +0900
Subject: [PATCH 04/12] Add automatic language detection for Learn More button
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Implement browser language detection similar to BEAR.Sunday:
- Add 'intl' class to Learn More button
- JavaScript detects navigator.language
- Auto-redirect Japanese users to /ja/ manual
- English users go to /en/ manual by default
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
index.html | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index e35a05b..f9b1755 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,18 @@
The Ontological Programming Framework for PHP
-
+
Learn more »
+
From d187dadf97b4c26b0288ffc4c019f997f2f2ed0b Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 13:30:37 +0900
Subject: [PATCH 05/12] Add NewsWeek-style philosophical quotations and section
headings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Added philosophical quotations to chapter openings in both languages
- Implemented consistent NewsWeek-style formatting with proper attribution
- Added section headings after quotations for better structure:
- Chapter 1: "ãŸãããããèŠãŠãã ãã" / "First, Look at This"
- Chapter 2: "åºçºç¹" / "The Beginning"
- Chapter 3: "å
åšãšè¶
è¶" / "Immanence Meets Transcendence"
- Chapter 4: "çµçç¹" / "The Destination"
- Chapter 12: "ããªããçºèŠãããã®" / "What You Have Discovered"
- Enhanced Chapter 4 with $been concept integration and temporal completion
- Unified philosophical framework across English and Japanese versions
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/01-overview.md | 6 +-
manuals/1.0/en/02-input-classes.md | 6 ++
manuals/1.0/en/03-being-classes.md | 6 ++
manuals/1.0/en/04-final-objects.md | 6 ++
.../1.0/en/12-from-doing-to-being-final.md | 6 +-
manuals/1.0/ja/01-overview.md | 6 +-
manuals/1.0/ja/02-input-classes.md | 6 ++
manuals/1.0/ja/03-being-classes.md | 6 ++
manuals/1.0/ja/04-final-objects.md | 98 ++++++++++++++-----
.../1.0/ja/12-from-doing-to-being-final.md | 6 +-
10 files changed, 125 insertions(+), 27 deletions(-)
diff --git a/manuals/1.0/en/01-overview.md b/manuals/1.0/en/01-overview.md
index 1dc98aa..3361b5f 100644
--- a/manuals/1.0/en/01-overview.md
+++ b/manuals/1.0/en/01-overview.md
@@ -5,7 +5,11 @@ category: Manual
permalink: /manuals/1.0/en/01-overview.html
---
-# Overview: A Different Way to Think About Code
+# A Different Way to Think About Code
+
+> "The real voyage of discovery consists not in seeking new landscapes, but in having new eyes."
+>
+> âMarcel Proust, 'The Prisoner' (In Search of Lost Time, Volume 5) 1923
## First, Look at This
diff --git a/manuals/1.0/en/02-input-classes.md b/manuals/1.0/en/02-input-classes.md
index 9720c34..54914ba 100644
--- a/manuals/1.0/en/02-input-classes.md
+++ b/manuals/1.0/en/02-input-classes.md
@@ -7,6 +7,12 @@ permalink: /manuals/1.0/en/02-input-classes.html
# Input Classes
+> "We begin from conditions we did not choose, and from there we build our existence."
+>
+> âFrom Heidegger's concept of Geworfenheit (thrownness) in 'Being and Time' (1927)
+
+## The Beginning
+
Input Classes are the starting point of every transformation in Be Framework.
They contain only what the object itself possessesâno external dependencies. Think of it as the object's identity. These elements exist within the object, forming what we call the object's **Immanent Nature**.
diff --git a/manuals/1.0/en/03-being-classes.md b/manuals/1.0/en/03-being-classes.md
index d38d993..1acf9e2 100644
--- a/manuals/1.0/en/03-being-classes.md
+++ b/manuals/1.0/en/03-being-classes.md
@@ -7,6 +7,12 @@ permalink: /manuals/1.0/en/03-being-classes.html
# Being Classes
+> "The Way constantly does nothing, yet nothing is left undone."
+>
+> âLaozi, Tao Te Ching, Chapter 37 (6th century BC)
+
+## Immanence Meets Transcendence
+
Being Classes are where transformation actually occurs.
The object's own nature (**Immanent Nature**) meets forces provided from the outside (**Transcendent Forces**), and a new being is born. If Input Classes are the "beginning," Being Classes express the "moment of change."
diff --git a/manuals/1.0/en/04-final-objects.md b/manuals/1.0/en/04-final-objects.md
index 45f2e3b..3fc7f06 100644
--- a/manuals/1.0/en/04-final-objects.md
+++ b/manuals/1.0/en/04-final-objects.md
@@ -7,6 +7,12 @@ permalink: /manuals/1.0/en/04-final-objects.html
# Final Objects
+> "You are not me. How can you know that I don't know the feelings of fish?"
+>
+> âZhuangzi's reply when asked "You are not a fish. How can you know the feelings of fish?" (Zhuangzi, 4th century BC)
+
+## The Destination
+
Final Objects represent the destination of metamorphosisâcomplete, transformed beings that embody the user's actual interest. These are what the application ultimately cares about.
## Characteristics of Final Objects
diff --git a/manuals/1.0/en/12-from-doing-to-being-final.md b/manuals/1.0/en/12-from-doing-to-being-final.md
index 37157b0..5c63655 100644
--- a/manuals/1.0/en/12-from-doing-to-being-final.md
+++ b/manuals/1.0/en/12-from-doing-to-being-final.md
@@ -7,7 +7,11 @@ permalink: /manuals/1.0/en/12-from-doing-to-being-final.html
# From Doing to Being: The Bigger Picture
-> *"The real voyage of discovery consists not in seeking new landscapes, but in having new eyes."* â Marcel Proust
+> "All things that exist are in the process of becoming."
+>
+> âHeraclitus, Fragments (c. 500 BC)
+
+## What You Have Discovered
You've written Input Classes, created Being Classes, and watched objects transform rather than mutate.
diff --git a/manuals/1.0/ja/01-overview.md b/manuals/1.0/ja/01-overview.md
index caff87a..5faf23a 100644
--- a/manuals/1.0/ja/01-overview.md
+++ b/manuals/1.0/ja/01-overview.md
@@ -5,7 +5,11 @@ category: Manual
permalink: /manuals/1.0/ja/01-overview.html
---
-## æŠèŠ: æ°ãããã©ãã€ã
+# æŠèŠ
+
+> ãçã®çºèŠã®èªæµ·ã¯ãæ°ãã颚æ¯ãæ±ããããšã§ã¯ãªããæ°ããç®ãæã€ããšã«ãããã
+>
+> ããâãã«ã»ã«ã»ãã«ãŒã¹ããåããã®å¥³ãïŒÃ la recherche du temps perdu 第5å·»ïŒ1923幎
## ãŸãããããèŠãŠãã ãã
diff --git a/manuals/1.0/ja/02-input-classes.md b/manuals/1.0/ja/02-input-classes.md
index 7e3f178..ff08507 100644
--- a/manuals/1.0/ja/02-input-classes.md
+++ b/manuals/1.0/ja/02-input-classes.md
@@ -7,6 +7,12 @@ permalink: /manuals/1.0/ja/02-input-classes.html
# å
¥åã¯ã©ã¹
+> ãç§ãã¡ã¯èªåã§éžæã§ããªãæ¡ä»¶ããå§ãŸããããããèªåã®ååšãç¯ãã
+>
+> ããâãã€ãã¬ãŒã®è¢«ææ§ïŒGeworfenheitïŒæŠå¿µããïŒãååšãšæéã1927幎ïŒ
+
+## åºçºç¹
+
å
¥åã¯ã©ã¹ã¯ãBeãã¬ãŒã ã¯ãŒã¯ã«ããããã¹ãŠã®å€å®¹ã®åºçºç¹ã§ãã
ããã«ã¯ãªããžã§ã¯ãèªèº«ãæã€èŠçŽ ã ããå«ãŸããå€éšäŸåããããŸãããããã°ãªããžã§ã¯ãã®ã¢ã€ãã³ãã£ãã£ã§ãããªããžã§ã¯ãã®å
åŽã«ãããã®ãªã®ã§ãããã**å
åšçæ§è³ªãã€ããã³ã¹ïŒImmanenceïŒ**ãšåŒã³ãŸãã
diff --git a/manuals/1.0/ja/03-being-classes.md b/manuals/1.0/ja/03-being-classes.md
index 0b1d419..423b2e0 100644
--- a/manuals/1.0/ja/03-being-classes.md
+++ b/manuals/1.0/ja/03-being-classes.md
@@ -7,6 +7,12 @@ permalink: /manuals/1.0/ja/03-being-classes.html
# ååšã¯ã©ã¹
+> ãéåžžç¡çºèç¡äžçºã
+>
+> âéã¯åžžã«ç¡çºã«ããŠãèãçºãããããšãªãïŒèåãé埳çµã第äžåäžç« ãçŽå
å6äžçŽïŒ
+
+## å
åšãšè¶
è¶
+
ååšã¯ã©ã¹ã¯å€å®¹ãå®éã«èµ·ããå Žæã§ãã
ãªããžã§ã¯ãèªèº«ãæã€æ§è³ªïŒ**å
åšçæ§è³ªïŒã€ããã³ã¹ïŒ**ïŒãšãå€éšããæäŸãããåïŒ**è¶
è¶çãªåïŒãã©ã³ã»ã³ãã³ã¹ïŒ**ïŒãåºäŒããæ¬¡ã®æ°ããååšãçãŸããŸããå
¥åã¯ã©ã¹ããå§ãŸãããªããååšã¯ã©ã¹ã¯ãå€ããç¬éãã衚çŸããŸãã
diff --git a/manuals/1.0/ja/04-final-objects.md b/manuals/1.0/ja/04-final-objects.md
index e3f2713..077ee58 100644
--- a/manuals/1.0/ja/04-final-objects.md
+++ b/manuals/1.0/ja/04-final-objects.md
@@ -7,19 +7,39 @@ permalink: /manuals/1.0/ja/04-final-objects.html
# æçµãªããžã§ã¯ã
-æçµãªããžã§ã¯ãã¯å€å®¹ã®ç®çå°ã衚ããŸãâãŠãŒã¶ãŒã®å®éã®é¢å¿ãäœçŸãããå®å
šã§å€å®¹ããååšã§ãããããã¯ã¢ããªã±ãŒã·ã§ã³ãæçµçã«æ°ã«ããããã®ã§ãã
+> ãããªãã¯ç§ã§ã¯ãªããã©ãããŠç§ãéã®æ°æã¡ãç¥ããªããšåããã®ãïŒã
+>
+> âãããªãã¯éã§ã¯ãªããã©ãããŠéã®æ°æã¡ãåããã®ãããšåãããæã«èåãè¿ããèšè ïŒãèåãçŽå
å4äžçŽïŒ
+
+## çµçç¹
+
+æçµãªããžã§ã¯ãã¯å€å®¹ã®æ
è·¯ã®å°éç¹ã§ãã
+ãŠãŒã¶ãŒãæ±ãã䟡å€ãã¢ããªã±ãŒã·ã§ã³ãå±ãããçµæãå
·çŸåããããå®å
šã§æçµçãªååšã§ãã
+
+ããã¯å
¥åã¯ã©ã¹ããå§ãŸã£ãå
åšçæ§è³ªïŒã€ããã³ã¹ïŒããæ§ã
ãªè¶
è¶çåïŒãã©ã³ã»ã³ãã³ã¹ïŒãšåºäŒããèªç¶ãªå€å®¹ãçµãŠéæããæçµåœ¢æ
ã§ããã¢ãªã¹ããã¬ã¹ã®èšããšã³ãã¬ã±ã€ã¢ãããªãã¡æœåšæ§ãå®å
šã«çŸå®åãããç¶æ
ãäœçŸããŠããŸãã
## æçµãªããžã§ã¯ãã®ç¹åŸŽ
-**å®å
šãªååš**: æçµãªããžã§ã¯ãã¯æå³ãããç®çã®ããã«ãããªãå€å®¹ãå¿
èŠãšããªããå®å
šã«åœ¢æããããšã³ãã£ãã£ã§ãã
+**å®å
šæ§ïŒãšã³ãã¬ã±ã€ã¢ïŒ**: ãã以äžã®å€å®¹ãå¿
èŠãšããªããå®å
šã«çŸå®åãããååšã§ãã
+
+**ãŠãŒã¶ãŒäŸ¡å€ã®å®çŸ**: ãŠãŒã¶ãŒãæ¬åœã«å¿
èŠãšãããã®ãæå³ã®ããããŒã¿ãæäœã®æåçµæã衚çŸããŸãã
+
+**è±ããªç¶æ
**: å
¥åã¯ã©ã¹ãšã¯å¯Ÿç
§çã«ãæçµãªããžã§ã¯ãã¯ãã¡ã€ã³ã®è±å¯ããå®å
šã«è¡šçŸããååšã§ãã
+
+## æéçååšã®å®å
šæ§
+
+ããã§è峿·±ãåãããããŸãããã¹ããäžèŠã«ãªãã»ã©ã®å®å
šæ§ãæã€ãªããžã§ã¯ãããã£ããã©ãã§ãããïŒ
-**ãŠãŒã¶ãŒäžå¿**: ãããã¯ãŠãŒã¶ãŒãå®éã«æ¬²ãããã®âæåããæäœãæå³ã®ããããŒã¿ãå®è¡å¯èœãªçµæã衚ããŸãã
+Be Frameworkã§ã¯ããªããžã§ã¯ãã®æéçååšãäºã€ã®è»žã§æããŸãïŒ
-**è±å¯ãªç¶æ
**: å
¥åã¯ã©ã¹ãšã¯ç°ãªããæçµãªããžã§ã¯ãã¯å€å®¹ãããããŒã¿ã®å®å
šãªè±ãããå«ã¿ãŸãã
+- **`#[Be]`**: ãªãããèªåãåããå
ïŒæªæ¥ãžã®æ¹åæ§ïŒ
+- **`$been`**: å®äºããèªåïŒéå»å®äºã®èªå·±èšŒæïŒ
+
+åŸæ¥ã®ããã°ã©ãã³ã°ã§ã¯ããªããžã§ã¯ããæ£ããåŠçããããã©ãããå€éšã®ãã¹ãã§æ€èšŒããŸãããããããªããžã§ã¯ãèªèº«ãå®äºã®èšŒæ ãå
å
ããŠãããã©ãã§ãããïŒå€éšã«ããæ€èšŒã§ã¯ãªããå
åšçãªèªå·±èšŒæãå¯èœã«ãªããŸãã
## äŸ
-### æåããçµæ
+### å
åšçèªå·±èšŒæãæã€çµæ
```php
final class SuccessfulOrder
{
@@ -27,51 +47,79 @@ final class SuccessfulOrder
public readonly string $confirmationCode;
public readonly DateTimeImmutable $timestamp;
public readonly string $message;
+ public readonly BeenProcessed $been; // èªå·±èšŒæ
public function __construct(
- #[Input] Money $total, // æ€èšŒããã®å
åšç
- #[Input] CreditCard $card, // æ€èšŒããã®å
åšç
- #[Inject] OrderIdGenerator $generator, // è¶
è¶ç
- #[Inject] Receipt $receipt // è¶
è¶ç
+ #[Input] Money $total, // å
åšçæ§è³ª
+ #[Input] CreditCard $card, // å
åšçæ§è³ª
+ #[Inject] OrderIdGenerator $generator, // è¶
è¶çå
+ #[Inject] Receipt $receipt // è¶
è¶çå
) {
- $this->orderId = $generator->generate(); // æ°ããå
åšç
- $this->confirmationCode = $receipt->generate($total); // æ°ããå
åšç
- $this->timestamp = new DateTimeImmutable(); // æ°ããå
åšç
- $this->message = "泚æç¢ºèª: {$this->orderId}"; // æ°ããå
åšç
+ $this->orderId = $generator->generate(); // æ°ããå
åšçæ§è³ª
+ $this->confirmationCode = $receipt->generate($total); // æ°ããå
åšçæ§è³ª
+ $this->timestamp = new DateTimeImmutable(); // æ°ããå
åšçæ§è³ª
+ $this->message = "泚æç¢ºèª: {$this->orderId}"; // æ°ããå
åšçæ§è³ª
+
+ // å®äºã®èªå·±èšŒæ
+ $this->been = new BeenProcessed(
+ actor: $card->getHolderName(),
+ timestamp: $this->timestamp,
+ evidence: [
+ 'total' => $total->getAmount(),
+ 'payment_method' => $card->getType(),
+ 'confirmation' => $this->confirmationCode
+ ]
+ );
}
}
```
-### æçµãªããžã§ã¯ããšããŠã®ãšã©ãŒç¶æ
+ãã®ãªããžã§ã¯ãã¯å€éšãã¹ããå¿
èŠãšããŸããã`$been`ããããã£ãå®äºã®å®å
šãªèšŒæ ãå
å
ããŠããããã§ãã
+
+### ãšã©ãŒç¶æ
ã®èªå·±èšŒæ
```php
final class FailedOrder
{
public readonly string $errorCode;
public readonly string $message;
public readonly DateTimeImmutable $timestamp;
+ public readonly BeenRejected $been; // 倱æã®èªå·±èšŒæ
public function __construct(
- #[Input] array $errors, // æ€èšŒããã®å
åšç
- #[Inject] Logger $logger, // è¶
è¶ç
- #[Inject] ErrorCodeGenerator $generator // è¶
è¶ç
+ #[Input] array $errors, // å
åšçæ§è³ª
+ #[Inject] Logger $logger, // è¶
è¶çå
+ #[Inject] ErrorCodeGenerator $generator // è¶
è¶çå
) {
$this->errorCode = $generator->generate();
$this->message = "泚æå€±æ: " . implode(', ', $errors);
$this->timestamp = new DateTimeImmutable();
+ // 倱æã®èªå·±èšŒæ
+ $this->been = new BeenRejected(
+ reason: 'validation_failed',
+ timestamp: $this->timestamp,
+ evidence: [
+ 'error_count' => count($errors),
+ 'error_types' => array_keys($errors),
+ 'error_code' => $this->errorCode
+ ]
+ );
+
$logger->logOrderFailure($this->errorCode, $errors); // å¯äœçš
}
}
```
+æåã倱æããã©ã¡ããå®äºã®èªå·±èšŒæãæã¡ãŸããå€éšãã¹ãã§ã¯ãªãããªããžã§ã¯ãèªèº«ãäœãèµ·ãã£ããã®å®å
šãªèšé²ãä¿æããŠããã®ã§ãã
+
## æçµãªããžã§ã¯ã vs å
¥åã¯ã©ã¹
| å
¥åã¯ã©ã¹ | æçµãªããžã§ã¯ã |
|-----------|-----------------|
-| çŽç²ãªã¢ã€ãã³ãã£ã㣠| è±å¯ã§å€å®¹ããç¶æ
|
-| åºçºç¹ | ç®çå° |
+| çŽç²ãªã¢ã€ãã³ãã£ã㣠| è±ãã§å€å®¹ããç¶æ
|
+| å€å®¹ã®åºçºç¹ | å€å®¹ã®å°éç¹ |
| ãŠãŒã¶ãŒãæäŸãããã® | ãŠãŒã¶ãŒãåãåããã® |
-| åçŽãªæ§é | å®å
šãªæ©èœ |
+| ã·ã³ãã«ãªæ§é | å®å
šã«å®çŸãããæ©èœ |
## è€æ°ã®æçµçéåœ
@@ -99,8 +147,12 @@ if ($order->being instanceof SuccessfulOrder) {
2. **ååšã¯ã©ã¹**: å€å®¹æ®µéïŒããããç§ã®å€åã®ä»æ¹ã§ããïŒ
3. **æçµãªããžã§ã¯ã**: å®å
šãªçµæïŒããããç§ããªã£ããã®ã§ããïŒ
-ãŠãŒã¶ãŒã¯äž»ã«å
¥åïŒåœŒããæäŸãããã®ïŒãšæçµãªããžã§ã¯ãïŒåœŒããåãåããã®ïŒã«é¢å¿ãæã¡ãŸããéã«ããååšã¯ã©ã¹ã¯ãã¬ãŒã ã¯ãŒã¯ã®è²¬ä»»ã§ãâæå³ãšçµæã®éã®æ©ãäœãå€å®¹ã®æ©æ¢°ã§ãã
+ãŠãŒã¶ãŒã¯äž»ã«å
¥åïŒåœŒããæäŸãããã®ïŒãšæçµãªããžã§ã¯ãïŒåœŒããåãåããã®ïŒã«é¢å¿ãæã¡ãŸããéã«ããååšã¯ã©ã¹ã¯ç§ãã¡èšèšè
ã®è²¬ä»»ã§ããæå³ãšçµæã®éã®æ©æž¡ããããããã«ãã¡ã€ã³ã®æéçå€å®¹ãããçè§£ãããã®å€å®¹ã®ä»çµã¿ãèšèšããããšãéèŠã§ãã
+
+## å€å®¹ã®å®æ
+
+æçµãªããžã§ã¯ãã¯ããšã³ãã¬ã±ã€ã¢ïŒå®å
šå®çŸïŒã®ç¶æ
ã衚çŸããŸããå€å®¹ã®å¿
èŠããããªããå®å
šã«å®çŸãããååšã§ãã
-## èªç¶ãªå®æ
+å
¥åã¯ã©ã¹ããå§ãŸã£ãå
åšçæ§è³ªïŒã€ããã³ã¹ïŒããæ§ã
ãªè¶
è¶çåïŒãã©ã³ã»ã³ãã³ã¹ïŒãšåºäŒããªããèªç¶ãªå€å®¹ãçµãŠãã€ãã«å°éããå®æåœ¢ã§ããããã«ã¯ããããªãããšãããåªåãããå€ããããšãããæå³ããããŸããããã¹ãŠãå®äºãããŠãŒã¶ãŒãæ¬åœã«æ±ããŠãã䟡å€ãããã«å®çŸãããŠããŸããç§ãã¡ã®ã·ã¹ãã ã®æ¬è³ªçãªäŸ¡å€ã§ãã
-æçµãªããžã§ã¯ãã¯èªç¶ãªå€å®¹ã®å®æãäœçŸããŸãããããã¯ããäœããããããå¿
èŠããããŸããâåçŽã«ãå
ã®å
¥åãäžçã®èœåãšåºäŒãããšããçãŸããããšãæå³ãããçµæ*ã§ãã*ã®ã§ãã
\ No newline at end of file
+ããããããBe Frameworkãç®æãããã°ã©ãã³ã°ã®å°éç¹âãäœãããããã§ã¯ãªããäœã§ãããããäœçŸãããååšã§ãã
diff --git a/manuals/1.0/ja/12-from-doing-to-being-final.md b/manuals/1.0/ja/12-from-doing-to-being-final.md
index a915665..958f410 100644
--- a/manuals/1.0/ja/12-from-doing-to-being-final.md
+++ b/manuals/1.0/ja/12-from-doing-to-being-final.md
@@ -7,7 +7,11 @@ permalink: /manuals/1.0/ja/12-from-doing-to-being-final.html
# Doingãã Beingãž: ãã倧ããªèŠç¹
-> *ãçã®çºèŠã®èªæµ·ã¯ãæ°ãã颚æ¯ãæ±ããããšã§ã¯ãªããæ°ããç®ãæã€ããšã«ãããã* â ãã«ã»ã«ã»ãã«ãŒã¹ã
+> ãååšãããã®ã¯å
šãŠçæã®éäžã«ããã
+>
+> ããâãã©ã¯ã¬ã€ãã¹ãæçãïŒçŽå
å500幎é ïŒ
+
+## ããªããçºèŠãããã®
ããªãã¯å
¥åã¯ã©ã¹ãæžããååšã¯ã©ã¹ãäœæãããªããžã§ã¯ããå€ç°ããã®ã§ã¯ãªãå€å®¹ããã®ãèŠãŠããŸããã
From b115013f9f52c21e8ec16ab215545417260c3f48 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 13:31:53 +0900
Subject: [PATCH 06/12] Improve Laozi quotation translation in Chapter 3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change "The Way constantly does nothing" to "The Tao does nothing"
for more accurate and concise philosophical expression.
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/03-being-classes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manuals/1.0/en/03-being-classes.md b/manuals/1.0/en/03-being-classes.md
index 1acf9e2..c7fe6f7 100644
--- a/manuals/1.0/en/03-being-classes.md
+++ b/manuals/1.0/en/03-being-classes.md
@@ -7,7 +7,7 @@ permalink: /manuals/1.0/en/03-being-classes.html
# Being Classes
-> "The Way constantly does nothing, yet nothing is left undone."
+> "The Tao does nothing, yet nothing is left undone."
>
> âLaozi, Tao Te Ching, Chapter 37 (6th century BC)
From 2871cc8ec5b9a8233636b7795546405c334f1aba Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 13:39:21 +0900
Subject: [PATCH 07/12] Complete $been concept integration in English Chapter 4
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Added Temporal Completeness section with #[Be] and $been axes
- Integrated intrinsic self-evidence with BeenProcessed and BeenRejected examples
- Enhanced both success and failure objects with complete temporal evidence
- Added philosophical conclusion about entelecheia and transformation completion
- Unified English and Japanese versions with identical $been concept depth
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/04-final-objects.md | 75 +++++++++++++++++++++++-------
1 file changed, 59 insertions(+), 16 deletions(-)
diff --git a/manuals/1.0/en/04-final-objects.md b/manuals/1.0/en/04-final-objects.md
index 3fc7f06..d0aa83f 100644
--- a/manuals/1.0/en/04-final-objects.md
+++ b/manuals/1.0/en/04-final-objects.md
@@ -23,9 +23,20 @@ Final Objects represent the destination of metamorphosisâcomplete, transformed
**Rich State**: Unlike Input Classes, Final Objects contain the full richness of transformed data.
+## Temporal Completeness
+
+Here's an intriguing question: What if objects had such completeness that they needed no external testing?
+
+The Be Framework captures the temporal existence of objects along two axes:
+
+- **`#[Be]`**: The intended self, the destination (future directionality)
+- **`$been`**: The completed self (past perfect self-evidence)
+
+Traditional programming verifies whether objects have been processed correctly through external tests. But what if objects themselves contained evidence of their completion? Instead of external verification, intrinsic self-evidence becomes possible.
+
## Examples
-### Successful Outcomes
+### Intrinsic Self-Evidence
```php
final class SuccessfulOrder
{
@@ -33,43 +44,71 @@ final class SuccessfulOrder
public readonly string $confirmationCode;
public readonly DateTimeImmutable $timestamp;
public readonly string $message;
+ public readonly BeenProcessed $been; // Self-evidence
public function __construct(
- #[Input] Money $total, // Immanent from validation
- #[Input] CreditCard $card, // Immanent from validation
- #[Inject] OrderIdGenerator $generator, // Transcendent
- #[Inject] Receipt $receipt // Transcendent
+ #[Input] Money $total, // Immanent nature
+ #[Input] CreditCard $card, // Immanent nature
+ #[Inject] OrderIdGenerator $generator, // Transcendent force
+ #[Inject] Receipt $receipt // Transcendent force
) {
- $this->orderId = $generator->generate(); // New Immanent
- $this->confirmationCode = $receipt->generate($total); // New Immanent
- $this->timestamp = new DateTimeImmutable(); // New Immanent
- $this->message = "Order confirmed: {$this->orderId}"; // New Immanent
+ $this->orderId = $generator->generate(); // New immanent nature
+ $this->confirmationCode = $receipt->generate($total); // New immanent nature
+ $this->timestamp = new DateTimeImmutable(); // New immanent nature
+ $this->message = "Order confirmed: {$this->orderId}"; // New immanent nature
+
+ // Self-evidence of completion
+ $this->been = new BeenProcessed(
+ actor: $card->getHolderName(),
+ timestamp: $this->timestamp,
+ evidence: [
+ 'total' => $total->getAmount(),
+ 'payment_method' => $card->getType(),
+ 'confirmation' => $this->confirmationCode
+ ]
+ );
}
}
```
-### Error States as Final Objects
+This object requires no external testing. The `$been` property contains complete evidence of completion.
+
+### Error States with Self-Evidence
```php
final class FailedOrder
{
public readonly string $errorCode;
public readonly string $message;
public readonly DateTimeImmutable $timestamp;
+ public readonly BeenRejected $been; // Self-evidence of failure
public function __construct(
- #[Input] array $errors, // Immanent from validation
- #[Inject] Logger $logger, // Transcendent
- #[Inject] ErrorCodeGenerator $generator // Transcendent
+ #[Input] array $errors, // Immanent nature
+ #[Inject] Logger $logger, // Transcendent force
+ #[Inject] ErrorCodeGenerator $generator // Transcendent force
) {
$this->errorCode = $generator->generate();
$this->message = "Order failed: " . implode(', ', $errors);
$this->timestamp = new DateTimeImmutable();
+ // Self-evidence of failure
+ $this->been = new BeenRejected(
+ reason: 'validation_failed',
+ timestamp: $this->timestamp,
+ evidence: [
+ 'error_count' => count($errors),
+ 'error_types' => array_keys($errors),
+ 'error_code' => $this->errorCode
+ ]
+ );
+
$logger->logOrderFailure($this->errorCode, $errors); // Side effect
}
}
```
+Both success and failure carry their own self-evidence of completion. Instead of external tests, the objects themselves maintain complete records of what occurred.
+
## Final Objects vs Input Classes
| Input Classes | Final Objects |
@@ -105,8 +144,12 @@ The path from Input to Final Object represents a complete transformation journey
2. **Being Classes**: Transformation stages ("Here's how I change")
3. **Final Object**: Complete result ("Here's what I became")
-Users primarily care about Input (what they provide) and Final Objects (what they get back). The Being Classes in between are the framework's responsibilityâthe machinery of transformation that creates the bridge between intention and result.
+Users primarily care about Input (what they provide) and Final Objects (what they get back). The Being Classes in between are our responsibility as designers. It's crucial to understand the temporal transformation of the domain well and design the mechanisms of that transformation to bridge intention and result.
+
+## Transformation Complete
+
+Final Objects express the state of entelecheia (complete realization). They are fully realized beings that no longer need transformation.
-## Natural Completion
+The immanent nature that began with Input Classes, through encounters with various transcendent forces and natural transformation, finally reaches this completed form. There is no more "trying to become" or "intending to change." Everything is complete, and the value that users truly sought is realized here. This is the essential value of our system.
-Final Objects embody the completion of natural transformation. They don't need to "do" anything moreâthey simply *are* the result that was meant to emerge from the original input's encounter with the world's capabilities.
+This is the destination that Be Framework aims for in programmingâexistence that embodies not "what to do" but "what to be."
From 35b11a2b485823d10b3b5ffed0ebb1a7ad205640 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 14:10:17 +0900
Subject: [PATCH 08/12] Restructure Chapter 5 to eliminate redundancy and
enhance clarity
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Added Heraclitus philosophical quotation with proper NewsWeek-style formatting
- Added "å€å®¹ã®æµã" / "Patterns of Change" section headings after quotations
- Consolidated redundant "Branching Destinies" and "Conditional Transformation" into unified "Conditional Branching Pattern"
- Removed obvious "Fork-Join Pattern" that was just parallel data collection
- Enhanced "Self-Organizing Pipelines" section with UNIX pipes comparison
- Updated pattern selection list to remove redundancy
- Improved final message to be more natural
- Applied consistent structure across both Japanese and English versions
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/05-metamorphosis-patterns.md | 86 ++++++++++-----------
manuals/1.0/ja/05-metamorphosis-patterns.md | 85 ++++++++++----------
2 files changed, 85 insertions(+), 86 deletions(-)
diff --git a/manuals/1.0/en/05-metamorphosis-patterns.md b/manuals/1.0/en/05-metamorphosis-patterns.md
index 42a80e8..eda5d4b 100644
--- a/manuals/1.0/en/05-metamorphosis-patterns.md
+++ b/manuals/1.0/en/05-metamorphosis-patterns.md
@@ -7,7 +7,13 @@ permalink: /manuals/1.0/en/05-metamorphosis-patterns.html
# Metamorphosis Patterns
-Be Framework supports various patterns of transformation, from simple linear chains to complex branching destinies. Understanding these patterns helps you design natural transformation flows.
+> "No man ever steps in the same river twice."
+>
+> âHeraclitus, Fragments (c. 500 BC)
+
+## Patterns of Change
+
+Be Framework supports various patterns of transformation, from simple linear chains to complex branching. Understanding these patterns helps you design natural transformation flows.
## Linear Metamorphic Chain
@@ -32,9 +38,9 @@ final class WelcomeMessage { /* ... */ }
Each stage naturally leads to the next, like a river flowing to the sea.
-## Branching Destinies
+## Conditional Branching Pattern
-Objects can have multiple possible futures based on their nature:
+Objects can have multiple possible futures based on their nature. This is natural transformation that branches into different types based on conditions:
```php
#[Be([ApprovedApplication::class, RejectedApplication::class])]
@@ -55,42 +61,9 @@ final class ApplicationReview
}
```
-The object determines its own destiny through **Type-Driven Metamorphosis**.
-
-## Fork-Join Pattern
-
-A single input branches into parallel transformations that later converge:
-
-```php
-#[Be(PersonalizedRecommendation::class)]
-final class UserAnalysis
-{
- public readonly PersonalizedRecommendation $being;
-
- public function __construct(
- #[Input] string $userId, // Immanent
- #[Inject] BehaviorAnalyzer $behavior, // Transcendent
- #[Inject] PreferenceAnalyzer $preference, // Transcendent
- #[Inject] SocialAnalyzer $social // Transcendent
- ) {
- // Parallel analysis
- $behaviorScore = $behavior->analyze($userId);
- $preferenceScore = $preference->analyze($userId);
- $socialScore = $social->analyze($userId);
-
- // Convergence
- $this->being = new PersonalizedRecommendation(
- $behaviorScore,
- $preferenceScore,
- $socialScore
- );
- }
-}
-```
-
-## Conditional Transformation
+### Other Conditional Branching Examples
-Sometimes transformation depends on runtime conditions:
+Feature levels and permissions follow the same pattern:
```php
#[Be([PremiumFeatures::class, BasicFeatures::class])]
@@ -111,6 +84,10 @@ final class FeatureActivation
}
```
+The object determines its own destiny through **Type-Driven Metamorphosis**.
+
+
+
## Nested Metamorphosis
Complex objects can contain their own transformation chains:
@@ -134,7 +111,26 @@ final class OrderProcessing
## Self-Organizing Pipelines
-The beauty of these patterns is that they're **self-organizing**. Objects declare their own destinies, and the framework naturally follows the transformation paths without external orchestration.
+The beauty of these patterns is that they're **self-organizing**. Like UNIX pipes that combine simple commands to create powerful systems, Be Framework combines typed objects to create natural transformation flows.
+
+### Comparison with UNIX Pipes
+
+```bash
+# UNIX: Text flows through externally controlled pipelines
+cat access.log | grep "404" | awk '{print $7}' | sort | uniq -c
+```
+
+```php
+// Be Framework: Rich objects flow through intrinsically controlled pipelines
+$finalObject = $becoming(new ApplicationInput($documents));
+// Objects themselves know their next transformation destination
+```
+
+Key evolution:
+- **UNIX**: External shell controls the pipeline
+- **Be Framework**: Objects declare their own destiny with `#[Be()]`
+
+### Self-Organization in Action
```php
// No controllers, no orchestratorsâjust natural flow
@@ -147,14 +143,18 @@ match (true) {
};
```
+This self-organization provides:
+- No external orchestration needed
+- Type safety maintained
+- Capabilities provided through dependency injection
+- Testable independent components
+
## Pattern Selection
Choose patterns based on your domain's natural flow:
- **Linear**: Sequential processes (validation â processing â completion)
-- **Branching**: Decision points (approve/reject, success/failure)
-- **Fork-Join**: Parallel analysis that converges
-- **Conditional**: Feature flags, permissions, subscriptions
+- **Conditional Branching**: Decision points (approve/reject, success/failure, permission levels)
- **Nested**: Complex operations with sub-processes
-The key is to let the transformation emerge naturally from the domain logic, not force it into artificial patterns.
+The key is to let transformation emerge naturally from the domain's flow, not force it into artificial patterns.
diff --git a/manuals/1.0/ja/05-metamorphosis-patterns.md b/manuals/1.0/ja/05-metamorphosis-patterns.md
index 543afbc..d1e81f1 100644
--- a/manuals/1.0/ja/05-metamorphosis-patterns.md
+++ b/manuals/1.0/ja/05-metamorphosis-patterns.md
@@ -7,7 +7,13 @@ permalink: /manuals/1.0/ja/05-metamorphosis-patterns.html
# å€å®¹ãã¿ãŒã³
-Beãã¬ãŒã ã¯ãŒã¯ã¯ãåçŽãªç·åœ¢ãã§ãŒã³ããè€éãªåå²ããéåœãŸã§ãæ§ã
ãªå€å®¹ãã¿ãŒã³ããµããŒãããŸãããããã®ãã¿ãŒã³ãçè§£ããããšã§ãèªç¶ãªå€å®¹ãããŒãèšèšã§ããŸãã
+> ãåãå·ã«äºåºŠå
¥ãããšã¯ã§ããªãã
+>
+> ããâãã©ã¯ã¬ã€ãã¹ãæçãïŒçŽå
å500幎é ïŒ
+
+## å€å®¹ã®æµã
+
+Beãã¬ãŒã ã¯ãŒã¯ã¯ãåçŽãªç·åœ¢ãã§ãŒã³ããè€éãªåå²ãŸã§ãæ§ã
ãªå€å®¹ãã¿ãŒã³ããµããŒãããŸãããããã®ãã¿ãŒã³ãçè§£ããããšã§ãèªç¶ãªå€å®¹ãããŒãèšèšã§ããŸãã
## ç·åœ¢å€å®¹ãã§ãŒã³
@@ -32,9 +38,9 @@ final class WelcomeMessage { /* ... */ }
åæ®µéã¯èªç¶ã«æ¬¡ãžãšå°ãããå·ãæµ·ã«æµããããã§ãã
-## åå²ããéåœ
+## æ¡ä»¶åå²ãã¿ãŒã³
-ãªããžã§ã¯ãã¯ãã®æ§è³ªã«åºã¥ããŠè€æ°ã®å¯èœãªæªæ¥ãæã€ããšãã§ããŸãïŒ
+ãªããžã§ã¯ãã¯ãã®æ§è³ªã«åºã¥ããŠè€æ°ã®å¯èœãªæªæ¥ãæã€ããšãã§ããŸããããã¯æ¡ä»¶ã«ãã£ãŠç°ãªãåãžãšåå²ããèªç¶ãªå€å®¹ã§ãïŒ
```php
#[Be([ApprovedApplication::class, RejectedApplication::class])]
@@ -55,42 +61,9 @@ final class ApplicationReview
}
```
-ãªããžã§ã¯ãã¯**åé§åå€å®¹**ãéããŠèªèº«ã®éåœã決å®ããŸãã
-
-## ãã©ãŒã¯ã»ãžã§ã€ã³ãã¿ãŒã³
+### ä»ã®æ¡ä»¶åå²äŸ
-åäžã®å
¥åã䞊åå€å®¹ã«åå²ããåŸã«åæããŸãïŒ
-
-```php
-#[Be(PersonalizedRecommendation::class)]
-final class UserAnalysis
-{
- public readonly PersonalizedRecommendation $being;
-
- public function __construct(
- #[Input] string $userId, // å
åšç
- #[Inject] BehaviorAnalyzer $behavior, // è¶
è¶ç
- #[Inject] PreferenceAnalyzer $preference, // è¶
è¶ç
- #[Inject] SocialAnalyzer $social // è¶
è¶ç
- ) {
- // 䞊ååæ
- $behaviorScore = $behavior->analyze($userId);
- $preferenceScore = $preference->analyze($userId);
- $socialScore = $social->analyze($userId);
-
- // åæ
- $this->being = new PersonalizedRecommendation(
- $behaviorScore,
- $preferenceScore,
- $socialScore
- );
- }
-}
-```
-
-## æ¡ä»¶ä»ãå€å®¹
-
-æãšããŠå€å®¹ã¯ã©ã³ã¿ã€ã æ¡ä»¶ã«äŸåããŸãïŒ
+æ©èœã¬ãã«ãæš©éã«ããåå²ãåæ§ã®ãã¿ãŒã³ã§ãïŒ
```php
#[Be([PremiumFeatures::class, BasicFeatures::class])]
@@ -111,6 +84,9 @@ final class FeatureActivation
}
```
+ãªããžã§ã¯ãã¯**åé§åå€å®¹**ãéããŠèªèº«ã®éåœã決å®ããŸãã
+
+
## ãã¹ãããå€å®¹
è€éãªãªããžã§ã¯ãã¯ç¬èªã®å€å®¹ãã§ãŒã³ãå«ãããšãã§ããŸãïŒ
@@ -134,7 +110,26 @@ final class OrderProcessing
## èªå·±çµç¹åãã€ãã©ã€ã³
-ãããã®ãã¿ãŒã³ã®çŸããã¯ããããã**èªå·±çµç¹å**ã§ããããšã§ãããªããžã§ã¯ãã¯èªèº«ã®éåœã宣èšãããã¬ãŒã ã¯ãŒã¯ã¯å€éšã®ãªãŒã±ã¹ãã¬ãŒã·ã§ã³ãªãã«èªç¶ã«å€å®¹ãã¹ã«åŸããŸãã
+ãããã®ãã¿ãŒã³ã®çŸããã¯ããããã**èªå·±çµç¹å**ã§ããããšã§ããUnixãã€ããåçŽãªã³ãã³ããçµã¿åãããŠåŒ·åãªã·ã¹ãã ãäœãããã«ãBeãã¬ãŒã ã¯ãŒã¯ã¯åä»ããªããžã§ã¯ããçµã¿åãããŠèªç¶ãªå€å®¹ã®æµããäœããŸãã
+
+### Unixãã€ããšã®æ¯èŒ
+
+```bash
+# Unix: ããã¹ããæµããå€éšå¶åŸ¡ã®ãã€ãã©ã€ã³
+cat access.log | grep "404" | awk '{print $7}' | sort | uniq -c
+```
+
+```php
+// Be Framework: ãªãããªãªããžã§ã¯ããæµããå
åšçå¶åŸ¡ã®ãã€ãã©ã€ã³
+$finalObject = $becoming(new ApplicationInput($documents));
+// ãªããžã§ã¯ãèªèº«ã次ã®å€å®¹å
ãç¥ã£ãŠãã
+```
+
+éèŠãªé²åïŒ
+- **Unix**: å€éšã®shellããã€ããå¶åŸ¡
+- **Be Framework**: ãªããžã§ã¯ãèªèº«ã`#[Be()]`ã§éåœã宣èš
+
+### èªå·±çµç¹åã®å®çŸ
```php
// ã³ã³ãããŒã©ãŒããªãŒã±ã¹ãã¬ãŒã¿ãŒããªãâãã èªç¶ãªæµã
@@ -147,14 +142,18 @@ match (true) {
};
```
+ãã®èªå·±çµç¹åã«ããïŒ
+- å€éšãªãŒã±ã¹ãã¬ãŒã·ã§ã³ãäžèŠ
+- åå®å
šæ§ãä¿ããã
+- äŸåæ§æ³šå
¥ã«ããèœåã®æäŸ
+- ãã¹ãå¯èœãªç¬ç«ããã³ã³ããŒãã³ã
+
## ãã¿ãŒã³ã®éžæ
ãã¡ã€ã³ã®èªç¶ãªæµãã«åºã¥ããŠãã¿ãŒã³ãéžæããŠãã ããïŒ
- **ç·åœ¢**: é æ¬¡ããã»ã¹ïŒæ€èšŒ â åŠç â å®äºïŒ
-- **åå²**: 決å®ãã€ã³ãïŒæ¿èª/æåŠãæå/倱æïŒ
-- **ãã©ãŒã¯ã»ãžã§ã€ã³**: åæãã䞊ååæ
-- **æ¡ä»¶ä»ã**: æ©èœãã©ã°ãæš©éããµãã¹ã¯ãªãã·ã§ã³
+- **æ¡ä»¶åå²**: 決å®ãã€ã³ãïŒæ¿èª/æåŠãæå/倱æãæš©éã¬ãã«ïŒ
- **ãã¹ããã**: ãµãããã»ã¹ãæã€è€éãªæäœ
-éèŠãªã®ã¯ãå€å®¹ããã¡ã€ã³ããžãã¯ããèªç¶ã«çãŸããããããšã§ããã人工çãªãã¿ãŒã³ã«åŒ·å¶ããããšã§ã¯ãããŸããã
\ No newline at end of file
+éèŠãªã®ã¯ãå€å®¹ããã¡ã€ã³ã®èªç¶ãªæµãããçãŸããããããšã§ããã人工çãªãã¿ãŒã³ã«åŒ·å¶ããããšã§ã¯ãããŸããã
From 2e68a7124124c3d2214fd948401391e4003bae55 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 15:08:17 +0900
Subject: [PATCH 09/12] Restructure Chapter 5: From Patterns to Metamorphosis
Philosophy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Transform Chapter 5 from pattern catalog to philosophical overview of metamorphosis,
integrating Einstein's space-time inseparability with Heraclitean flow philosophy.
Major changes:
- Replace Heraclitean quote with Einstein's authentic 1916 general relativity quote
- Add core concept: time and domain cannot be separated
- Restructure from pattern-focused to essence-focused metamorphosis overview
- Replace linear patterns with temporal flow (T0âT1âT2âT3)
- Rename conditional branching to "self-determination of destiny"
- Remove quantum superposition section for practical balance
- Add comprehensive implementation guidelines
- Conclude with Heraclitean philosophy connecting to Be Framework essence
Both Japanese and English versions updated with philosophical depth while
maintaining practical utility as framework documentation.
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/05-metamorphosis-patterns.md | 133 ++++++++++++-------
manuals/1.0/ja/05-metamorphosis-patterns.md | 136 +++++++++++++-------
2 files changed, 171 insertions(+), 98 deletions(-)
diff --git a/manuals/1.0/en/05-metamorphosis-patterns.md b/manuals/1.0/en/05-metamorphosis-patterns.md
index eda5d4b..8568e29 100644
--- a/manuals/1.0/en/05-metamorphosis-patterns.md
+++ b/manuals/1.0/en/05-metamorphosis-patterns.md
@@ -1,46 +1,46 @@
---
layout: docs-en
-title: "5. Metamorphosis Patterns"
+title: "5. Metamorphosis"
category: Manual
-permalink: /manuals/1.0/en/05-metamorphosis-patterns.html
+permalink: /manuals/1.0/en/05-metamorphosis.html
---
-# Metamorphosis Patterns
+# Metamorphosis
-> "No man ever steps in the same river twice."
+> "Space and time cannot be defined independently of each other."
>
-> âHeraclitus, Fragments (c. 500 BC)
+> âAlbert Einstein, The Foundation of the General Theory of Relativity (1916)
-## Patterns of Change
+## Time and Domain Are Inseparable
-Be Framework supports various patterns of transformation, from simple linear chains to complex branching. Understanding these patterns helps you design natural transformation flows.
+Just as Einstein discovered the inseparability of time and space, the Be Framework considers time and domain as a single entity that cannot be divided. Approval processes have their approval time, payments have their payment time, and transformation naturally emerges along the unique temporal axis that each domain logic possesses.
-## Linear Metamorphic Chain
+## Irreversible Flow of Time
-The simplest pattern: A â B â C â D
+Object metamorphosis follows the arrow of time in a unidirectional flow. There is no returning to the past, no remaining in the same moment:
```php
-// Input
+// Time T0: Birth of input
#[Be(EmailValidation::class)]
final class EmailInput { /* ... */ }
-// First transformation
+// Time T1: First metamorphosis (T0 is already past)
#[Be(UserCreation::class)]
final class EmailValidation { /* ... */ }
-// Second transformation
+// Time T2: Second metamorphosis (T1 becomes memory)
#[Be(WelcomeMessage::class)]
final class UserCreation { /* ... */ }
-// Final result
+// Time T3: Final existence (encompassing all past)
final class WelcomeMessage { /* ... */ }
```
-Each stage naturally leads to the next, like a river flowing to the sea.
+Each moment never returns, and new existence preserves previous forms as memory within itself. Like a river flowing, time moves only in one direction.
-## Conditional Branching Pattern
+## Self-Determination of Destiny
-Objects can have multiple possible futures based on their nature. This is natural transformation that branches into different types based on conditions:
+Like living beings in reality, objects determine their own destiny through the interaction between intrinsic nature and external environment. This is not following a predetermined route, but natural metamorphosis responding to the circumstances of that moment:
```php
#[Be([ApprovedApplication::class, RejectedApplication::class])]
@@ -49,11 +49,12 @@ final class ApplicationReview
public readonly ApprovedApplication|RejectedApplication $being;
public function __construct(
- #[Input] array $documents, // Immanent
- #[Inject] ReviewService $reviewer // Transcendent
+ #[Input] array $documents, // Intrinsic nature
+ #[Inject] ReviewService $reviewer // External environment
) {
$result = $reviewer->evaluate($documents);
+ // Destiny is decided at this very moment
$this->being = $result->isApproved()
? new ApprovedApplication($documents, $result->getScore())
: new RejectedApplication($result->getReasons());
@@ -61,31 +62,6 @@ final class ApplicationReview
}
```
-### Other Conditional Branching Examples
-
-Feature levels and permissions follow the same pattern:
-
-```php
-#[Be([PremiumFeatures::class, BasicFeatures::class])]
-final class FeatureActivation
-{
- public readonly PremiumFeatures|BasicFeatures $being;
-
- public function __construct(
- #[Input] User $user, // Immanent
- #[Inject] SubscriptionService $service // Transcendent
- ) {
- $subscription = $service->getSubscription($user);
-
- $this->being = $subscription->isPremium()
- ? new PremiumFeatures($user, $subscription)
- : new BasicFeatures($user);
- }
-}
-```
-
-The object determines its own destiny through **Type-Driven Metamorphosis**.
-
## Nested Metamorphosis
@@ -149,12 +125,71 @@ This self-organization provides:
- Capabilities provided through dependency injection
- Testable independent components
-## Pattern Selection
+## Implementation Guidelines
+
+### When to Choose Linear Metamorphosis
+
+For sequential processing where each stage prepares the data needed for the next:
+
+```php
+User Registration â Email Verification â Account Activation â Welcome Notification
+```
+
+This is suitable when failure at any stage should halt the entire process.
+
+### When to Choose Conditional Branching
+
+When the same input branches into different results based on nature or permissions:
+
+```php
+// Implementation example: Feature differentiation by payment capability
+#[Be([FullAccess::class, LimitedAccess::class, ReadOnlyAccess::class])]
+final class AccessDetermination
+{
+ public readonly FullAccess|LimitedAccess|ReadOnlyAccess $being;
+
+ public function __construct(
+ #[Input] User $user,
+ #[Inject] PaymentStatus $payment
+ ) {
+ $this->being = match($payment->getStatus()) {
+ 'premium' => new FullAccess($user, $payment->getFeatures()),
+ 'basic' => new LimitedAccess($user, $payment->getLimits()),
+ default => new ReadOnlyAccess($user)
+ };
+ }
+}
+```
+
+### When to Choose Nested Metamorphosis
+
+When executing multiple independent processes in parallel and aggregating their results:
+
+```php
+final class OrderCompletion
+{
+ public function __construct(
+ #[Input] OrderData $order,
+ #[Inject] Becoming $becoming
+ ) {
+ // Independent parallel processing
+ $this->inventory = $becoming(new InventoryCheck($order->items));
+ $this->payment = $becoming(new PaymentProcess($order->payment));
+ $this->shipping = $becoming(new ShippingArrange($order->address));
+ }
+}
+```
+
+## Design Principles
+
+Choose metamorphosis patterns according to the natural flow of domain logic:
-Choose patterns based on your domain's natural flow:
+- **Don't Force**: Don't force into artificial patterns
+- **Keep Simple**: Choose the most simple and understandable form
+- **Testable**: Each metamorphosis stage can be tested independently
+- **Type Safe**: Next type is guaranteed by `#[Be()]`
-- **Linear**: Sequential processes (validation â processing â completion)
-- **Conditional Branching**: Decision points (approve/reject, success/failure, permission levels)
-- **Nested**: Complex operations with sub-processes
+Objects govern their own metamorphosis.
-The key is to let transformation emerge naturally from the domain's flow, not force it into artificial patterns.
+Heraclitus said "the river flows" is not correct, but rather "the flowing is the river." He believed that existence cannot be separated from change. Be Framework likewise believes that to capture essence, domain and time cannot be separated.
+Domains are temporal existence. There are possibilities and being at each moment. Capturing how input classes, being classes, and final objects naturally metamorphose along the flow of time is the core of the Be Framework.
diff --git a/manuals/1.0/ja/05-metamorphosis-patterns.md b/manuals/1.0/ja/05-metamorphosis-patterns.md
index d1e81f1..2a256ba 100644
--- a/manuals/1.0/ja/05-metamorphosis-patterns.md
+++ b/manuals/1.0/ja/05-metamorphosis-patterns.md
@@ -1,46 +1,46 @@
---
layout: docs-ja
-title: "5. å€å®¹ãã¿ãŒã³"
+title: "5. ã¡ã¿ã¢ã«ãã©ãŒã·ã¹"
category: Manual
-permalink: /manuals/1.0/ja/05-metamorphosis-patterns.html
+permalink: /manuals/1.0/ja/05-metamorphosis.html
---
-# å€å®¹ãã¿ãŒã³
+# ã¡ã¿ã¢ã«ãã©ãŒã·ã¹
-> ãåãå·ã«äºåºŠå
¥ãããšã¯ã§ããªãã
+> ã空éãšæéã¯ç¬ç«ã«å®çŸ©ã§ããªãã
>
-> ããâãã©ã¯ã¬ã€ãã¹ãæçãïŒçŽå
å500幎é ïŒ
+> ããâã¢ã«ãã«ãã»ã¢ã€ã³ã·ã¥ã¿ã€ã³ãäžè¬çžå¯Ÿæ§çè«ã®åºç€ãïŒ1916幎ïŒ
-## å€å®¹ã®æµã
+## æéãšãã¡ã€ã³ã¯åå²ã§ããªã
-Beãã¬ãŒã ã¯ãŒã¯ã¯ãåçŽãªç·åœ¢ãã§ãŒã³ããè€éãªåå²ãŸã§ãæ§ã
ãªå€å®¹ãã¿ãŒã³ããµããŒãããŸãããããã®ãã¿ãŒã³ãçè§£ããããšã§ãèªç¶ãªå€å®¹ãããŒãèšèšã§ããŸãã
+ã¢ã€ã³ã·ã¥ã¿ã€ã³ãæéãšç©ºéã®äžå¯åæ§ãçºèŠããããã«ãBeãã¬ãŒã ã¯ãŒã¯ã§ã¯æéãšãã¡ã€ã³ã¯åå²ã§ããªãäžã€ã®å®äœã§ããæ¿èªããã»ã¹ã«ã¯æ¿èªã®æéããæ±ºæžã«ã¯æ±ºæžã®æéããããããããã®ãã¡ã€ã³ããžãã¯ãæã€åºæã®æéè»žã«æ²¿ã£ãŠå€å®¹ãèªç¶ã«çŸããŸãã
-## ç·åœ¢å€å®¹ãã§ãŒã³
+## äžå¯éçæéã®æµã
-æãã·ã³ãã«ãªãã¿ãŒã³ïŒA â B â C â D
+ãªããžã§ã¯ãã®å€å®¹ã¯æéã®ç¢ã«æ²¿ã£ãäžæ¹åã®æµãã§ããéå»ã«æ»ãããšããåãç¬éã«çãŸãããšãã§ããŸããïŒ
```php
-// å
¥å
+// æé T0: å
¥åã®èªç
#[Be(EmailValidation::class)]
final class EmailInput { /* ... */ }
-// 第äžå€å®¹
+// æé T1: 第äžå€å®¹ïŒT0ã¯æ¢ã«éå»ïŒ
#[Be(UserCreation::class)]
final class EmailValidation { /* ... */ }
-// 第äºå€å®¹
+// æé T2: 第äºå€å®¹ïŒT1ã¯èšæ¶ãšãªãïŒ
#[Be(WelcomeMessage::class)]
final class UserCreation { /* ... */ }
-// æçµçµæ
+// æé T3: æçµååšïŒãã¹ãŠã®éå»ãå
å
ïŒ
final class WelcomeMessage { /* ... */ }
```
-åæ®µéã¯èªç¶ã«æ¬¡ãžãšå°ãããå·ãæµ·ã«æµããããã§ãã
+åç¬éã¯äºåºŠãšæ»ãããæ°ããååšã¯åã®åœ¢æ
ããã®å
éšã«èšæ¶ãšããŠä¿æããŸããå·ãæµããããã«ãæéã¯äžæ¹åã«ã®ã¿æµããŸãã
-## æ¡ä»¶åå²ãã¿ãŒã³
+## éåœã®èªå·±æ±ºå®
-ãªããžã§ã¯ãã¯ãã®æ§è³ªã«åºã¥ããŠè€æ°ã®å¯èœãªæªæ¥ãæã€ããšãã§ããŸããããã¯æ¡ä»¶ã«ãã£ãŠç°ãªãåãžãšåå²ããèªç¶ãªå€å®¹ã§ãïŒ
+çŸå®ã®çç©ãšåæ§ã«ããªããžã§ã¯ãã¯å
åšçãªæ§è³ªãšå€éšç°å¢ã®çžäºäœçšã«ãã£ãŠãèªèº«ã®éåœã決å®ããŸããããã¯äºã決ããããã«ãŒãã蟿ãã®ã§ã¯ãªãããã®ç¬éã®ç¶æ³ã«å¿ããèªç¶ãªå€å®¹ã§ãïŒ
```php
#[Be([ApprovedApplication::class, RejectedApplication::class])]
@@ -49,11 +49,12 @@ final class ApplicationReview
public readonly ApprovedApplication|RejectedApplication $being;
public function __construct(
- #[Input] array $documents, // å
åšç
- #[Inject] ReviewService $reviewer // è¶
è¶ç
+ #[Input] array $documents, // å
åšçæ§è³ª
+ #[Inject] ReviewService $reviewer // å€éšç°å¢
) {
$result = $reviewer->evaluate($documents);
+ // éåœã¯ä»ãã®ç¬éã«æ±ºãŸã
$this->being = $result->isApproved()
? new ApprovedApplication($documents, $result->getScore())
: new RejectedApplication($result->getReasons());
@@ -61,31 +62,6 @@ final class ApplicationReview
}
```
-### ä»ã®æ¡ä»¶åå²äŸ
-
-æ©èœã¬ãã«ãæš©éã«ããåå²ãåæ§ã®ãã¿ãŒã³ã§ãïŒ
-
-```php
-#[Be([PremiumFeatures::class, BasicFeatures::class])]
-final class FeatureActivation
-{
- public readonly PremiumFeatures|BasicFeatures $being;
-
- public function __construct(
- #[Input] User $user, // å
åšç
- #[Inject] SubscriptionService $service // è¶
è¶ç
- ) {
- $subscription = $service->getSubscription($user);
-
- $this->being = $subscription->isPremium()
- ? new PremiumFeatures($user, $subscription)
- : new BasicFeatures($user);
- }
-}
-```
-
-ãªããžã§ã¯ãã¯**åé§åå€å®¹**ãéããŠèªèº«ã®éåœã決å®ããŸãã
-
## ãã¹ãããå€å®¹
@@ -148,12 +124,74 @@ match (true) {
- äŸåæ§æ³šå
¥ã«ããèœåã®æäŸ
- ãã¹ãå¯èœãªç¬ç«ããã³ã³ããŒãã³ã
-## ãã¿ãŒã³ã®éžæ
+## å®è£
äžã®éžææé
+
+### ãã€ç·åœ¢å€å®¹ãéžã¶ã
+
+ã·ãŒã±ã³ã·ã£ã«ãªåŠçã§ãåæ®µéãæ¬¡ã«å¿
èŠãªããŒã¿ãæºåããå ŽåïŒ
+
+```php
+ãŠãŒã¶ãŒç»é² â ã¡ãŒã«æ€èšŒ â ã¢ã«ãŠã³ãæå¹å â ãŠã§ã«ã«ã éç¥
+```
+
+åæ®µéã§ã®å€±æã¯å
šäœã忢ãããå¿
èŠãããå Žåã«é©ããŠããŸãã
+
+### ãã€æ¡ä»¶åå²ãéžã¶ã
+
+åãå
¥åããæ§è³ªãæš©éã«ãã£ãŠç°ãªãçµæã«åå²ããå ŽåïŒ
+
+```php
+// å®è£
äŸïŒæ¯æãèœåã«ããæ©èœå·®
+#[Be([FullAccess::class, LimitedAccess::class, ReadOnlyAccess::class])]
+final class AccessDetermination
+{
+ public readonly FullAccess|LimitedAccess|ReadOnlyAccess $being;
+
+ public function __construct(
+ #[Input] User $user,
+ #[Inject] PaymentStatus $payment
+ ) {
+ $this->being = match($payment->getStatus()) {
+ 'premium' => new FullAccess($user, $payment->getFeatures()),
+ 'basic' => new LimitedAccess($user, $payment->getLimits()),
+ default => new ReadOnlyAccess($user)
+ };
+ }
+}
+```
+
+### ãã€ãã¹ãããå€å®¹ãéžã¶ã
+
+è€æ°ã®ç¬ç«ããåŠçã䞊è¡ããŠå®è¡ããããããã®çµæãéçŽããå ŽåïŒ
+
+```php
+final class OrderCompletion
+{
+ public function __construct(
+ #[Input] OrderData $order,
+ #[Inject] Becoming $becoming
+ ) {
+ // ç¬ç«ããåŠçã䞊è¡å®è¡
+ $this->inventory = $becoming(new InventoryCheck($order->items));
+ $this->payment = $becoming(new PaymentProcess($order->payment));
+ $this->shipping = $becoming(new ShippingArrange($order->address));
+ }
+}
+```
+
+## èšèšåå
+
+å€å®¹ãã¿ãŒã³ã®éžæã¯ããã¡ã€ã³ããžãã¯ã®èªç¶ãªæµãã«åŸã£ãŠãã ããïŒ
+
+- **匷å¶ããªã**: 人工çãªãã¿ãŒã³ã«ç¡çããåœãŠã¯ããªã
+- **ã·ã³ãã«ã«**: æãåçŽã§çè§£ãããã圢ãéžã¶
+- **ãã¹ãå¯èœ**: åå€å®¹æ®µéãç¬ç«ããŠãã¹ãã§ãã
+- **åå®å
š**: `#[Be()]` ã«ãã£ãŠæ¬¡ã®åãä¿èšŒããã
+
+ãªããžã§ã¯ãã¯èªããèªãã®å€å®¹ãèŠå®ããŸãã
+
+ãã©ã¯ã¬ã€ãã¹ã¯ãå·ãæµããŠãããã®ã§ã¯ãªããæµããŠããã®ãå·ã ããšèšããŸãããååšã¯å€åãšã¯åãé¢ããªããšèããã®ã§ããBe Frameworkãåãããã«æ¬è³ªãæããããã«ã¯ãã¡ã€ã³ãšæéã¯åãé¢ããªããã®ãšèããŸããã
+ãã¡ã€ã³ã¯æéçååšã§ãããã®æãã®æã®å¯èœæ§ãšååšããããŸããå
¥åã¯ã©ã¹ãååšã¯ã©ã¹ãæçµãªããžã§ã¯ããæéã®æµãã«æ²¿ã£ãŠèªç¶ã«å€å®¹ããŠããæ§ãæããããšããBeãã¬ãŒã ã¯ãŒã¯ã®æ žå¿ã§ãã
-ãã¡ã€ã³ã®èªç¶ãªæµãã«åºã¥ããŠãã¿ãŒã³ãéžæããŠãã ããïŒ
-- **ç·åœ¢**: é æ¬¡ããã»ã¹ïŒæ€èšŒ â åŠç â å®äºïŒ
-- **æ¡ä»¶åå²**: 決å®ãã€ã³ãïŒæ¿èª/æåŠãæå/倱æãæš©éã¬ãã«ïŒ
-- **ãã¹ããã**: ãµãããã»ã¹ãæã€è€éãªæäœ
-éèŠãªã®ã¯ãå€å®¹ããã¡ã€ã³ã®èªç¶ãªæµãããçãŸããããããšã§ããã人工çãªãã¿ãŒã³ã«åŒ·å¶ããããšã§ã¯ãããŸããã
From 2306a31b8579878a3c5c9b8d5eee4815a54125e8 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 16:32:45 +0900
Subject: [PATCH 10/12] Complete semantic variables concept integration in
Japanese Chapter 6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Key enhancements:
- Replace abstract introduction with practical problem/solution structure
- Add semantic completeness concept explaining distributed vs integrated approach
- Include hierarchical validation with concrete business examples
- Introduce relationship constraints with automatic pattern matching
- Transform final section from bullet points to flowing philosophical prose
- Strengthen the core principle: "Names are identifiers of meaning and constraints"
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/ja/06-semantic-variables.md | 166 +++++++++++++++++++-----
1 file changed, 133 insertions(+), 33 deletions(-)
diff --git a/manuals/1.0/ja/06-semantic-variables.md b/manuals/1.0/ja/06-semantic-variables.md
index 8a337c8..cf32eab 100644
--- a/manuals/1.0/ja/06-semantic-variables.md
+++ b/manuals/1.0/ja/06-semantic-variables.md
@@ -7,35 +7,49 @@ permalink: /manuals/1.0/ja/06-semantic-variables.html
# æå³å€æ°
-> ãååšãã¹ããã®ã¯æå¹ã§ãªããã°ãªããŸãããååšã§ããªããã®ã¯æ±ºããŠçãŸããããšã¯ãããŸãããã
+> ãååšãããã®ã¯å¿
ç¶çã«ååšããååšããªããã®ã¯å¿
ç¶çã«ååšããªãã
+>
+> ããâã¹ããã¶ããšãã«ã第1éšå®ç29ïŒ1677幎ïŒ
-æå³å€æ°ã¯Beãã¬ãŒã ã¯ãŒã¯ã®æãæ·±ãåçãäœçŸããŸãïŒ**æå³ã®ããååšã®ã¿ãååšã§ãã**ã
+ããŒã¿ã®åŠ¥åœæ§ã¯ã©ãã§ä¿èšŒãããã¹ãã§ããããïŒã³ã³ãããŒã©ãŒïŒã¢ãã«ïŒããªããŒã¿ãŒïŒ
-## åé¡
+Be Frameworkã®çãã¯æç¢ºã§ãïŒ**ååãã®ãã®ãå¶çŽãæã€ã¹ã**ãšèããŸãã
+`$email`ã¯åãªãæååã§ã¯ãªãã**æå¹ãªã¡ãŒã«ã¢ãã¬ã¹**ã§ããã¹ãã§ãã`$age`ã«ã¯ãã€ãã¹ã®å€ã¯ååšã§ããŸããã
-åŸæ¥ã®åã¯ç¡æå³ãªãã®ããå®ããŸãïŒ
+æå³å€æ°ã¯ãæ
å ±ã®èå¥åã§ãããæå³ã衚ããå¶çŽãæã€**å®å
šãªæ
å ±ã¢ãã«**ã§ãã
+
+## åé¡ïŒåæ£ããäžå®å
šæ§
+
+åŸæ¥ã®ã¢ãããŒãã§ã¯ãæå³ã®å®çŸ©ãæ£åšããŠããŸãïŒ
```php
-function createUser(string $name, string $email, int $age) {
- if (empty($name)) throw new Exception();
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new Exception();
- // ... ç¡éã®é²åŸ¡çããã°ã©ãã³ã°
-}
+// ã³ã³ãããŒã©ãŒ/model/validator...
+if (empty($name)) throw new Exception("error.name.empty");
+if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new Exception("error.email.invalid");
+
+// messages/ja.yml
+error.name.empty: "ååãå
¥åããŠãã ãã"
+error.email.invalid: "æå¹ãªã¡ãŒã«ã¢ãã¬ã¹ãå
¥åããŠãã ãã"
+
+// README.md
+// "ååã¯1-100æåã§ç©ºçœã®ã¿ã¯äžå¯..."
```
-## 解決æ³
+以äžã®åé¡ãçºçããŸãïŒ
+- **ããªããŒã·ã§ã³**ïŒã³ã³ãããŒã©ãŒã«æ£åš
+- **ãšã©ãŒã¡ãã»ãŒãž**ïŒå¥ãã¡ã€ã«ã§ç®¡ç
+- **å¶çŽã«ãŒã«**ïŒè€æ°ã®å Žæã«éè€
+- **æå³å®çŸ©**ïŒããã¥ã¡ã³ãã«ã®ã¿ååš
-æå³å€æ°ã¯ãããã¯æå¹ã§ããïŒããããããã¯ååšã§ããŸããïŒããžãšæ ¹æ¬çãªåããå€ããŸãã
+ã·ã¹ãã ãæ±ãæå³ãéäžããŠèŠãããšã®ã§ããå ŽæããããŸããã
-```php
-function createUser(PersonName $name, EmailAddress $email, Age $age) {
- // ããã«å°éããã°ãååšã¯æ¢ã«ä¿èšŒãããŠããŸã
-}
-```
+## 解決æ³ïŒæå³çå®å
šæ§
+
+Be Frameworkã¯ã忣ããå®çŸ©ã**å®å
šãªæ
å ±ã¢ãã«**ãšããŠçµ±åããŸããã³ã³ã¹ãã©ã¯ã¿ã®åŒæ°ãã¯ã©ã¹ã®ããããã£ã«ã¯ãç»é²ããã**æå³å€æ°**ã®ã¿ã䜿çšã§ããŸãã
## ååšã®å®çŸ©
-ãã¹ãŠã®æå³å€æ°ã¯ãã®ãã¡ã€ã³ã§äœãååšã§ããããå®çŸ©ããŸãïŒ
+æå³å€æ°ã¯å°çšãã©ã«ãã«ã¯ã©ã¹ãšããŠå®çŸ©ãããŸãïŒ
```php
final class Name
@@ -50,25 +64,45 @@ final class Name
}
```
-è€æ°ã®æ€èšŒã³ã³ããã¹ããèªç¶ã«ååšããŸãïŒ
+## æ€èšŒã³ã³ããã¹ã
+
+ç°ãªãããžãã¹ã³ã³ããã¹ãã«ã¯ç°ãªãã«ãŒã«ãé©çšãããããšããããŸããæå³å€æ°ã¯è€æ°ã®æ€èšŒã³ã³ããã¹ããèªç¶ã«ãµããŒãããŸãïŒ
```php
final class ProductCode
{
#[Validate]
- public function validate(string $code): void { /* æšæºã«ãŒã« */ }
+ public function validate(string $code): void
+ {
+ // æšæºçãªååã³ãŒãæ€èšŒïŒäŸïŒ8æ¡ã®è±æ°åïŒ
+ if (!preg_match('/^[A-Z0-9]{8}$/', $code)) {
+ throw new InvalidProductCodeException();
+ }
+ }
#[Validate]
- public function validateLegacy(#[Legacy] string $code): void { /* ã¬ã¬ã·ãŒã«ãŒã« */ }
+ public function validateLegacy(#[Legacy] string $code): void
+ {
+ // ã¬ã¬ã·ãŒã·ã¹ãã çšã®ç·©ãæ€èšŒïŒäŸïŒ6-10æ¡ã®è±æ°åïŒ
+ if (!preg_match('/^[A-Z0-9]{6,10}$/', $code)) {
+ throw new InvalidLegacyProductCodeException();
+ }
+ }
#[Validate]
- public function validatePremium(#[Premium] string $code): void { /* ãã¬ãã¢ã ã«ãŒã« */ }
+ public function validatePremium(#[Premium] string $code): void
+ {
+ // ãã¬ãã¢ã ååçšã®å³æ Œãªæ€èšŒïŒäŸïŒç¹å®ã®ãã¬ãã£ãã¯ã¹å¿
é ïŒ
+ if (!preg_match('/^PREM[A-Z0-9]{4}$/', $code)) {
+ throw new InvalidPremiumProductCodeException();
+ }
+ }
}
```
-## æå³ã®ãã倱æ
+## 倱æã®æå³
-ååšã倱æãããšããæå³ã¯ä¿æãããªããã°ãªããŸããïŒ
+ååšã倱æãããšãã倱æã®æå³ãä¿æãããªããã°ãªããŸããïŒ
```php
#[Message([
@@ -78,18 +112,18 @@ final class ProductCode
final class EmptyNameException extends DomainException {}
```
-ãã¬ãŒã ã¯ãŒã¯ã¯æããåã«**ãã¹ãŠã®æ€èšŒãšã©ãŒ**ãåéããäœãååšã§ããªããã®å®å
šãªçè§£ãäœãåºããŸãã
+ãã¬ãŒã ã¯ãŒã¯ã¯æåã«æããããäŸå€ã ãã§ãªãã**ãã¹ãŠã®æ€èšŒãšã©ãŒ**ãäŸå€ã®éåãšããŠåéãããªãååšã§ããªããã®å®å
šãªçè§£ãäœãåºããŸãã
## èªç¶ãªçµ±å
-æå³å€æ°ã¯ååšã³ã³ã¹ãã©ã¯ã¿ã§èªåçã«åäœããŸãïŒ
+æå³å€æ°ã¯ã³ã³ã¹ãã©ã¯ã¿ã§èªåçã«åäœããŸãïŒ
```php
final readonly class UserProfile
{
public function __construct(
#[Input] #[English] public string $name, // è±èªåãšããŠèªåæ€èšŒ
- #[Input] string $emailAddress, // ã¡ãŒã«ãšããŠèªåæ€èšŒ
+ #[Input] string $emailAddress, // ã¡ãŒã«ã¢ãã¬ã¹ãšããŠèªåæ€èšŒ
#[Inject] NameFormatter $formatter
) {
// ãã®æç¹ã§ããã¹ãŠã®å
¥åãæå¹ã§ããããšãä¿èšŒãããŠããŸã
@@ -97,9 +131,11 @@ final readonly class UserProfile
}
```
+倿°å`$name`ã¯`Name`æå³å€æ°ã¯ã©ã¹ãšã`$emailAddress`ã¯`EmailAddress`æå³å€æ°ã¯ã©ã¹ãšèªåçã«é¢é£ä»ããããŸãã
+
## éå±€çæ€èšŒ
-æå³å€æ°ã¯äºãã«æ§ç¯ã§ããŸãïŒ
+æå³å€æ°ã¯ä»ã®æå³å€æ°ãåºç€ãšããŠæ§ç¯ã§ããŸããããã¯ããžãã¹ã«ãŒã«ã®èªç¶ãªéå±€æ§é ãåã·ã¹ãã ã§è¡šçŸãã匷åãªææ³ã§ãã
```php
final class TeenAge
@@ -107,13 +143,68 @@ final class TeenAge
#[Validate]
public function validate(#[Teen] int $age): void
{
- // åºæ¬çãªAgeæ€èšŒãç¶æ¿ãããã£ãŒã³åºæã®ã«ãŒã«ã远å
+ // ãŸãåºæ¬çãªAgeæ€èšŒãå®è¡ãããïŒ#[Teen]ã«ããèªåçã«åŒã³åºãããïŒ
+ // ãã®åŸããã£ãŒã³åºæã®ã«ãŒã«ã远å
if ($age < 13) throw new TeenAgeTooYoungException();
if ($age > 19) throw new TeenAgeTooOldException();
}
}
```
+ãã®éå±€çã¢ãããŒãã«ãããè±ããªæå³ã®éå±€ãæ§ç¯ãããŸãïŒ
+
+- `Email` â `CorporateEmail`ïŒäŒæ¥ãã¡ã€ã³å¿
é ïŒâ `ExecutiveEmail`ïŒåœ¹å¡ã¬ãã«ã®å¶çŽïŒ
+- `Price` â `DiscountPrice`ïŒå²åŒçå¶éïŒâ `MemberPrice`ïŒäŒå¡ç¹äŸ¡ã«ãŒã«ïŒ
+- `Password` â `AdminPassword`ïŒç®¡çè
èŠä»¶ïŒâ `SystemPassword`ïŒã·ã¹ãã 管çè
ã®å³æ ŒèŠä»¶ïŒ
+- `Address` â `ShippingAddress`ïŒé
éå¯èœå°åïŒâ `InternationalAddress`ïŒåœéé
é察å¿ïŒ
+
+åéå±€ã¯åã®å±€ã®å¶çŽãç¶æ¿ããããã«åºæã®å¶çŽã远å ããŸããåºæ¬çãª`Email`æ€èšŒãéããªããã®ã¯ã決ããŠ`ExecutiveEmail`ãšããŠååšã§ããŸãããããã¯åãªãæ€èšŒã®çµã¿åããã§ã¯ãªãã**æŠå¿µã®èªç¶ãªç²Ÿç·»å**ã§ãã
+
+## é¢ä¿æ§å¶çŽ
+
+æå³å€æ°ã¯åç¬ã§ååšããã ãã§ãªããä»ã®æå³å€æ°ãšã®é¢ä¿æ§ãå¶çŽãšããŠæãŠãŸããç¹çãã¹ãã¯**ãã®èšè¿°ã®å®¹æã**ã§ãïŒ
+
+```php
+final readonly class UserRegistration
+{
+ public function __construct(
+ #[Input] string $email,
+ #[Input] string $confirmEmail,
+ #[Input] string $password,
+ #[Input] string $confirmPassword,
+ ) {
+ // äœãæžãå¿
èŠã¯ãããŸããïŒ
+ // ãã¬ãŒã ã¯ãŒã¯ãèªåçã«é¢ä¿æ§ãæ€èšŒããŸã
+ }
+}
+```
+
+ãã¬ãŒã ã¯ãŒã¯ã¯ã察象ã®ã³ã³ã¹ãã©ã¯ã¿ã®ã·ã°ããã£ãš**éšåããã**ããæ€èšŒã¯ã©ã¹ãèªåçã«çºèŠããé©çšããŸãã
+
+```php
+// ãããããã°...
+final class EmailConfirmation
+{
+ #[Validate]
+ public function validate(string $email, string $confirmEmail): void
+ {
+ if ($email !== $confirmEmail) {
+ throw new EmailMismatchException();
+ }
+ }
+}
+
+// $email, $confirmEmail ãæã€ä»»æã®ã³ã³ã¹ãã©ã¯ã¿ã§èªåé©çšãããïŒ
+```
+
+é¢ä¿æ§å¶çŽã®äŸïŒ
+- `$startDate` ãš `$endDate`ïŒéå§æ¥ã¯çµäºæ¥ããåã§ãªããã°ãªããªã
+- `$minPrice` ãš `$maxPrice`ïŒæå°äŸ¡æ Œã¯æå€§äŸ¡æ Œä»¥äžã§ãªããã°ãªããªã
+- `$email` ãš `$confirmEmail`ïŒã¡ãŒã«ã¢ãã¬ã¹ã®ç¢ºèªäžèŽãå¿
èŠ
+- `$currentPassword` ãš `$newPassword`ïŒæ°ãããã¹ã¯ãŒãã¯çŸåšã®ãã®ãšç°ãªãå¿
èŠ
+
+éçºè
ã¯ããžãã¹ã«ãŒã«ãäžåºŠå®çŸ©ããã ãã§ã該åœããã·ã°ããã£ãæã€å
šãŠã®ãªããžã§ã¯ãã§èªåçã«é©çšãããŸãããããã®å¶çŽã¯ããªããžã§ã¯ããååšãã**åææ¡ä»¶**ãšããŠæ©èœããŸããåæãæºããããªãéãããã®ãªããžã§ã¯ãã¯ååšããããšããã§ããŸããã
+
## ãšã©ãŒãã³ããªã³ã°
å€èšèªãšã©ãŒã¡ãã»ãŒãžã¯èªåçã«é©å¿ããŸãïŒ
@@ -127,13 +218,16 @@ try {
}
```
-## é©åœ
+## æå³ããããããã®
+
+**ååã¯ãæå³ãå¶çŽã®èå¥åã§ãã**ãã®åçŽãªåçã ãã§ããã¬ãŒã ã¯ãŒã¯ãšãããã»ã©ã®è±ããªäžçãå®çŸãããŸãã
+
+æå³å€æ°ã«ããã**äžå¯èœãªç¶æ
ãäžå¯èœã«ãªããŸã**ãç¡å¹ãªã¡ãŒã«ã¢ãã¬ã¹ã¯`$email`ãšããŠååšã§ãããè² ã®å¹Žéœ¢ã¯`$age`ãšããŠçãŸããããšãããããŸãããåšåº«ã®ãªãååã¯`$orderId`ãšããŠæ³šæãããããšãªããæ±äº¬23åºå€ã®äœæã¯`$city`ãšããŠé
éå
ã«æå®ãããããšããããŸããã
-æå³å€æ°ã¯**äžå¯èœãªç¶æ
ãäžå¯èœã«ãã**ããšã§é²åŸ¡çããã°ã©ãã³ã°ãæé€ããŸãã
+åã·ã¹ãã ãã®ãã®ã**ãã¡ã€ã³èšèª**ãšãªããååãããªãã®ããžãã¹ãã¡ã€ã³ã§äœãååšå¯èœããèªããŸãã
-åã·ã¹ãã ã¯**ãã¡ã€ã³èšèª**ã«ãªããŸãâååãããªãã®ããžãã¹ãã¡ã€ã³ã§äœãååšã§ãããã®æå³ãéã³ãŸãã
+颿°ã·ã°ããã£ãèŠãã°ãããã仿§æžã«ãªããŸãïŒ
-颿°ã·ã°ããã£ã¯**ããã¥ã¡ã³ã**ã«ãªããŸãïŒ
```php
function processOrder(ProductCode $product, PaymentAmount $amount, CustomerAge $age)
{
@@ -141,8 +235,14 @@ function processOrder(ProductCode $product, PaymentAmount $amount, CustomerAge $
}
```
+ãã®é¢æ°ã¯æå¹ãªååã³ãŒããæ£ã®éé¡ãæå¹ãªå¹Žéœ¢ã®ã¿ãåãå
¥ããŸããããã¥ã¡ã³ããèªãå¿
èŠã¯ãããŸããâåãå
šãŠãç©èªã£ãŠããŸãã
+
+é²åŸ¡çããã°ã©ãã³ã°ã¯äžèŠã«ãªããŸããåŒæ°ã®æ€èšŒãnull ãã§ãã¯ãç¯å²ç¢ºèªãåšåº«ç¢ºèªãå°ççå¶çŽâãããã¯ãã¹ãŠæå³å€æ°ãä¿èšŒããŸããã³ãŒãã¯æ¬æ¥ã®ç®çã§ããããžãã¹ããžãã¯ã®å®è£
ã«éäžã§ããã®ã§ãã
+
+åãªãåœåèŠçŽããå§ãŸã£ãæŠå¿µããéå±€çæ€èšŒãé¢ä¿æ§å¶çŽãå€éšãªãœãŒã¹çµ±åãŸã§çºå±ããå®å
šãªãã¡ã€ã³ä¿èšŒã·ã¹ãã ãæ§ç¯ããŸãã**ååã«èŸŒããããæå³ããã·ã¹ãã å
šäœã®æŽåæ§ãæ¯ããã®ã§ãã**
+
---
**次ãž**: ãªããžã§ã¯ããèªèº«ã®æ§è³ªãçºèŠãã[åé§åå€å®¹](07-type-driven-metamorphosis.html)ã«ã€ããŠåŠã³ãŸãããã
-*ãæå³å€æ°ã¯ããŒã¿ãæ€èšŒããã ãã§ãªããæå³ã®ããååšã®ã¿ãååšã§ããããšãä¿èšŒããŸããã*
\ No newline at end of file
+*ãæå³å€æ°ã¯ããŒã¿ãæ€èšŒããã ãã§ãªããæå³ã®ããååšã®ã¿ãååšã§ããããšãä¿èšŒããŸããã*
From 7e8c8c8f6d05a65f795b6b088892e7dfdf7c0983 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 16:43:27 +0900
Subject: [PATCH 11/12] Complete semantic variables concept integration in
English Chapter 6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Key enhancements:
- Replace abstract introduction with practical problem/solution structure using Spinoza quote
- Add semantic completeness concept explaining distributed vs integrated approach
- Include hierarchical validation with concrete business examples and natural refinement
- Introduce relationship constraints with automatic pattern matching capabilities
- Transform final section from bullet points to flowing philosophical prose
- Strengthen the core principle: "Names are identifiers of meaning and constraints"
- Add validation contexts section with detailed business rule examples
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/06-semantic-variables.md | 166 +++++++++++++++++++-----
1 file changed, 133 insertions(+), 33 deletions(-)
diff --git a/manuals/1.0/en/06-semantic-variables.md b/manuals/1.0/en/06-semantic-variables.md
index 909bd66..cb07461 100644
--- a/manuals/1.0/en/06-semantic-variables.md
+++ b/manuals/1.0/en/06-semantic-variables.md
@@ -7,35 +7,49 @@ permalink: /manuals/1.0/en/06-semantic-variables.html
# Semantic Variables
-> "What should exist must be valid. What cannot exist will never be born."
+> "What exists necessarily exists, and what does not exist necessarily does not exist"
+>
+> ããâSpinoza, *Ethics*, Part I, Proposition 29 (1677)
-Semantic Variables embody Be Framework's deepest principle: **only meaningful beings can exist**.
+Where should data validity be guaranteed? Controller? Model? Validator?
-## The Problem
+Be Framework's answer is clear: **names themselves should carry constraints**.
+`$email` should not be just a stringâit should be a **valid email address**. `$age` cannot have negative values.
-Traditional types defend against the meaningless:
+Semantic Variables are identifiers of information that express meaning and hold constraintsâthey are **complete information models**.
+
+## The Problem: Scattered Incompleteness
+
+Traditional approaches scatter the definition of meaning across multiple locations:
```php
-function createUser(string $name, string $email, int $age) {
- if (empty($name)) throw new Exception();
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new Exception();
- // ... endless defensive programming
-}
+// Controllers/models/validators...
+if (empty($name)) throw new Exception("error.name.empty");
+if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new Exception("error.email.invalid");
+
+// messages/en.yml
+error.name.empty: "Name is required"
+error.email.invalid: "Please enter a valid email address"
+
+// README.md
+// "Name must be 1-100 characters, whitespace-only not allowed..."
```
-## The Solution
+The following problems occur:
+- **Validation**: Scattered across controllers
+- **Error messages**: Managed in separate files
+- **Constraint rules**: Duplicated in multiple places
+- **Meaning definition**: Exists only in documentation
-Semantic Variables change the fundamental question from "Is this valid?" to "Can this exist?"
+There is no central place to see the meanings that the system handles.
-```php
-function createUser(PersonName $name, EmailAddress $email, Age $age) {
- // If we reach here, existence is already guaranteed
-}
-```
+## The Solution: Semantic Completeness
+
+Be Framework integrates scattered definitions into **complete information models**. Constructor arguments and class properties can only use registered **semantic variables**.
## Defining Existence
-Every semantic variable defines what can exist in its domain:
+Semantic variables are defined as classes in dedicated folders:
```php
final class Name
@@ -50,25 +64,45 @@ final class Name
}
```
-Multiple validation contexts exist naturally:
+## Validation Contexts
+
+Different business contexts may require different rules. Semantic variables naturally support multiple validation contexts:
```php
final class ProductCode
{
#[Validate]
- public function validate(string $code): void { /* standard rules */ }
+ public function validate(string $code): void
+ {
+ // Standard product code validation (e.g., 8-digit alphanumeric)
+ if (!preg_match('/^[A-Z0-9]{8}$/', $code)) {
+ throw new InvalidProductCodeException();
+ }
+ }
#[Validate]
- public function validateLegacy(#[Legacy] string $code): void { /* legacy rules */ }
+ public function validateLegacy(#[Legacy] string $code): void
+ {
+ // Relaxed validation for legacy systems (e.g., 6-10 digit alphanumeric)
+ if (!preg_match('/^[A-Z0-9]{6,10}$/', $code)) {
+ throw new InvalidLegacyProductCodeException();
+ }
+ }
#[Validate]
- public function validatePremium(#[Premium] string $code): void { /* premium rules */ }
+ public function validatePremium(#[Premium] string $code): void
+ {
+ // Strict validation for premium products (e.g., specific prefix required)
+ if (!preg_match('/^PREM[A-Z0-9]{4}$/', $code)) {
+ throw new InvalidPremiumProductCodeException();
+ }
+ }
}
```
-## Meaningful Failure
+## The Meaning of Failure
-When existence fails, meaning must be preserved:
+When existence fails, the meaning of failure must be preserved:
```php
#[Message([
@@ -78,18 +112,18 @@ When existence fails, meaning must be preserved:
final class EmptyNameException extends DomainException {}
```
-The framework collects **all validation errors** before throwing, creating complete understanding of what cannot exist.
+The framework collects not just the first thrown exception but **all validation errors** as a collection of exceptions, creating complete understanding of why existence is impossible.
## Natural Integration
-Semantic variables work automatically in Being constructors:
+Semantic variables work automatically in constructors:
```php
final readonly class UserProfile
{
public function __construct(
#[Input] #[English] public string $name, // Auto-validated as English name
- #[Input] string $emailAddress, // Auto-validated as email
+ #[Input] string $emailAddress, // Auto-validated as email address
#[Inject] NameFormatter $formatter
) {
// At this point, all inputs are guaranteed valid
@@ -97,9 +131,11 @@ final readonly class UserProfile
}
```
+The variable name `$name` is automatically associated with the `Name` semantic variable class, and `$emailAddress` with the `EmailAddress` semantic variable class.
+
## Hierarchical Validation
-Semantic variables can build upon each other:
+Semantic variables can build upon other semantic variables. This is a powerful technique for expressing the natural hierarchical structure of business rules in the type system.
```php
final class TeenAge
@@ -107,13 +143,68 @@ final class TeenAge
#[Validate]
public function validate(#[Teen] int $age): void
{
- // Inherits basic Age validation, adds teen-specific rules
+ // First, basic Age validation is executed (automatically called via #[Teen])
+ // Then, teen-specific rules are added
if ($age < 13) throw new TeenAgeTooYoungException();
if ($age > 19) throw new TeenAgeTooOldException();
}
}
```
+This hierarchical approach builds rich semantic hierarchies:
+
+- `Email` â `CorporateEmail` (corporate domain required) â `ExecutiveEmail` (executive-level constraints)
+- `Price` â `DiscountPrice` (discount rate limits) â `MemberPrice` (member pricing rules)
+- `Password` â `AdminPassword` (admin requirements) â `SystemPassword` (strict system admin requirements)
+- `Address` â `ShippingAddress` (deliverable regions) â `InternationalAddress` (international shipping support)
+
+Each layer inherits constraints from the previous layer and adds its own unique constraints. Nothing that fails basic `Email` validation can ever exist as `ExecutiveEmail`. This is not merely a combination of validationsâit is the **natural refinement of concepts**.
+
+## Relationship Constraints
+
+Semantic variables exist not only in isolation but can also hold relationships with other semantic variables as constraints. What's remarkable is **how easy this is to describe**:
+
+```php
+final readonly class UserRegistration
+{
+ public function __construct(
+ #[Input] string $email,
+ #[Input] string $confirmEmail,
+ #[Input] string $password,
+ #[Input] string $confirmPassword,
+ ) {
+ // Nothing needs to be written here!
+ // The framework automatically validates relationships
+ }
+}
+```
+
+The framework automatically discovers and applies validation classes that **partially match** the target constructor's signature.
+
+```php
+// If this exists...
+final class EmailConfirmation
+{
+ #[Validate]
+ public function validate(string $email, string $confirmEmail): void
+ {
+ if ($email !== $confirmEmail) {
+ throw new EmailMismatchException();
+ }
+ }
+}
+
+// It's automatically applied to any constructor with $email, $confirmEmail!
+```
+
+Examples of relationship constraints:
+- `$startDate` and `$endDate`: Start date must be before end date
+- `$minPrice` and `$maxPrice`: Minimum price must be less than or equal to maximum price
+- `$email` and `$confirmEmail`: Email address confirmation match required
+- `$currentPassword` and `$newPassword`: New password must differ from current one
+
+Developers define business rules once, and they're automatically applied to all objects with matching signatures. These constraints function as **preconditions** for object existence. Unless preconditions are met, that object cannot even exist.
+
## Error Handling
Multilingual error messages adapt automatically:
@@ -127,13 +218,16 @@ try {
}
```
-## The Revolution
+## What Meaning Brings
+
+**Names are identifiers of meaning and constraints.** This simple principle alone realizes a world rich enough to be called a framework.
+
+Semantic Variables make **impossible states impossible**. Invalid email addresses cannot exist as `$email`, negative ages cannot be born as `$age`. Out-of-stock products cannot be ordered as `$orderId`, and addresses outside delivery zones cannot be specified as `$shippingAddress`.
-Semantic Variables eliminate defensive programming by making **impossible states impossible**.
+The type system itself becomes a **domain language**, where each type speaks of what can exist in your business domain.
-The type system becomes a **domain language**âeach type carries the meaning of what can exist in your business domain.
+Looking at function signatures, they become specifications:
-Function signatures become **documentation**:
```php
function processOrder(ProductCode $product, PaymentAmount $amount, CustomerAge $age)
{
@@ -141,8 +235,14 @@ function processOrder(ProductCode $product, PaymentAmount $amount, CustomerAge $
}
```
+This function accepts only valid product codes, positive amounts, and valid ages. No need to read documentationâthe types tell the whole story.
+
+Defensive programming becomes unnecessary. Argument validation, null checks, range verification, inventory confirmation, geographic constraintsâsemantic variables guarantee all of these. Code can focus on its true purpose: implementing business logic.
+
+What began as a simple naming convention evolves into hierarchical validation, relationship constraints, external resource integration, building a complete domain guarantee system. **The meaning embedded in names supports the integrity of the entire system.**
+
---
-**Next**: Learn about [Type-Driven Metamorphosis](06-type-driven-metamorphosis.md) where objects discover their own nature.
+**Next**: Learn about [Type-Driven Metamorphosis](07-type-driven-metamorphosis.html) where objects discover their own nature.
*"Semantic Variables don't just validate dataâthey ensure only meaningful beings can exist."*
From 6a89f1ff38a4781f838a718e00b12d2ca70ec633 Mon Sep 17 00:00:00 2001
From: Akihito Koriyama
Date: Fri, 12 Sep 2025 17:09:14 +0900
Subject: [PATCH 12/12] Fix metamorphosis chapter slug references and unify
terminology
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Update index links in both languages to use new slug: 05-metamorphosis.html
- Unify English terminology: "Immanent/Transcendent" â "Intrinsic nature/External environment"
- Ensure consistency across all metamorphosis pattern examples
- Remove outdated 05-metamorphosis-patterns.html references
ð€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude
---
manuals/1.0/en/05-metamorphosis-patterns.md | 4 ++--
manuals/1.0/en/index.md | 2 +-
manuals/1.0/ja/index.md | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/manuals/1.0/en/05-metamorphosis-patterns.md b/manuals/1.0/en/05-metamorphosis-patterns.md
index 8568e29..2a3afba 100644
--- a/manuals/1.0/en/05-metamorphosis-patterns.md
+++ b/manuals/1.0/en/05-metamorphosis-patterns.md
@@ -75,8 +75,8 @@ final class OrderProcessing
public readonly ShippingResult $shipping;
public function __construct(
- #[Input] Order $order, // Immanent
- #[Inject] Becoming $becoming // Transcendent
+ #[Input] Order $order, // Intrinsic nature
+ #[Inject] Becoming $becoming // External environment
) {
// Nested transformations
$this->payment = $becoming(new PaymentInput($order->getPayment()));
diff --git a/manuals/1.0/en/index.md b/manuals/1.0/en/index.md
index c5fec09..cdbfb37 100644
--- a/manuals/1.0/en/index.md
+++ b/manuals/1.0/en/index.md
@@ -21,7 +21,7 @@ Intermediate transformations through Immanent + Transcendent interactions
## [4. Final Objects](04-final-objects.html)
The destination of metamorphosis - complete transformed beings
-## [5. Metamorphosis Patterns](05-metamorphosis-patterns.html)
+## [5. Metamorphosis Patterns](05-metamorphosis.html)
Simple chains, branching destinies, and complex transformations
## [6. Semantic Variables](06-semantic-variables.html)
diff --git a/manuals/1.0/ja/index.md b/manuals/1.0/ja/index.md
index 5f231ef..4571b2c 100644
--- a/manuals/1.0/ja/index.md
+++ b/manuals/1.0/ja/index.md
@@ -20,7 +20,7 @@ permalink: /manuals/1.0/ja/
## [4. æçµãªããžã§ã¯ã](04-final-objects.html)
å€å®¹ã®ç®çå° - å®å
šã«å€å®¹ããååš
-## [5. å€å®¹ãã¿ãŒã³](05-metamorphosis-patterns.html)
+## [5. å€å®¹ãã¿ãŒã³](05-metamorphosis.html)
åçŽãªé£éãåå²ããéåœãè€éãªå€å®¹
## [6. æå³å€æ°](06-semantic-variables.html)