第243章 MVC完整数据流
243.1 提出背景
前面的章节已经分别建立了 ICAI 的 Controller、Service、Engine、Domain Object、Repository 和 MySQL 工程关系。
第239章建立:
Controller→ServiceController\rightarrow Service
第240章建立:
Service→EngineService\rightarrow Engine
第241章建立:
Engine→DomainObjectEngine\rightarrow DomainObject
第242章建立:
Repository→MySQLRepository\rightarrow MySQL
第242B章进一步建立:
DomainObject→RepositoryInterface→Repository→MySQLDomainObject \rightarrow RepositoryInterface \rightarrow Repository \rightarrow MySQL
这些关系分别讨论时,可以理解每一个工程层的职责,但是一个完整的 ICAI Web 系统还必须回答一个问题:
用户在 Browser 中发出一个请求以后,数据究竟经过哪些层,最终又如何返回到 Browser?
因此,本章建立 ICAI 的完整 MVC 数据流:
Browser→Controller→Service→Engine→DomainObject→Repository→MySQL\boxed{ Browser \rightarrow Controller \rightarrow Service \rightarrow Engine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL }
数据库处理完成以后,再通过:
MySQL→Repository→DomainObject→Engine→Service→Controller→View→Browser\boxed{ MySQL \rightarrow Repository \rightarrow DomainObject \rightarrow Engine \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Browser }
形成完整的数据往返过程。
243.2 MVC完整数据流定义
MVC完整数据流(Complete MVC Data Flow),是指 Browser 发起请求后,系统经过 Controller、Service、Engine、Domain Object、Repository、MySQL 完成数据处理,再经过 View 将结果呈现给 Browser 的完整运行路径。
基本模型:
Browser
↓
Controller
↓
Service
↓
Engine
↓
Domain Object
↓
Repository
↓
MySQL
↓
Repository
↓
Domain Object
↓
Engine
↓
Service
↓
Controller
↓
View
↓
Browser
因此:
MVCDataFlow=RequestFlow+PersistenceFlow+ResponseFlow\boxed{ MVCDataFlow= RequestFlow+PersistenceFlow+ResponseFlow }
其中:
RequestFlow:请求进入系统;PersistenceFlow:对象与数据库之间的数据交换;ResponseFlow:处理结果返回页面。
243.3 Browser
Browser 是 ICAI Web 系统与用户之间的外部交互入口。
例如用户访问:
/admin/individual.php?id=1001
Browser 产生 HTTP Request:
GET /admin/individual.php?id=1001
其中包含:
- URL;
- HTTP Method;
- Query 参数;
- Form 参数;
- Cookie;
- Session 信息;
- 请求头。
Browser 本身不负责 ICAI 业务计算。
因此:
Browser≠BusinessEngineBrowser\neq BusinessEngine
Browser 的主要作用是:
User→HTTPRequestUser \rightarrow HTTPRequest
以及:
HTTPResponse→UserHTTPResponse \rightarrow User
243.4 Browser请求
完整请求可以表示为:
Request=Method+URL+Parameter+Session+HeaderRequest= Method+URL+Parameter+Session+Header
例如:
GET
↓
/admin/individual.php
↓
id=1001
Controller 接收到请求以后,才开始进入 ICAI 的服务器端处理过程。
因此:
Browser→HTTPRequest→ControllerBrowser \rightarrow HTTPRequest \rightarrow Controller
243.5 Controller接收请求
Controller 是 Web 请求进入 ICAI 应用程序的第一层。
例如:
class IndividualController
{
protected $service;
public function __construct(
IndividualService $service
) {
$this->service = $service;
}
public function detail($id)
{
return $this->service
->getIndividual($id);
}
}
Controller 的职责主要包括:
接收请求
↓
读取参数
↓
验证基础参数
↓
调用 Service
↓
获得结果
↓
准备 View 数据
↓
输出响应
Controller 不应该直接承担复杂领域计算。
因此:
Controller≠EngineController\neq Engine
243.6 Controller参数处理
Browser 提交的数据首先进入 Controller。
例如:
?id=1001
Controller 获取:
$id = isset($_GET['id'])
? (int) $_GET['id']
: 0;
然后进行基础验证:
if ($id <= 0) {
throw new Exception(
'Invalid individual ID'
);
}
因此:
BrowserParameter→ControllerParameterBrowserParameter \rightarrow ControllerParameter
但是 Controller 不应该继续执行完整业务逻辑。
243.7 Controller到Service
参数处理完成以后:
Controller→ServiceController \rightarrow Service
例如:
$result =
$this->service
->getIndividual($id);
此时 Controller 的主要任务已经完成。
Controller 不需要知道:
MySQL表名
SQL语句
PDO连接
数据库字段
这些内容属于后面的持久化层。
243.8 Service组织业务流程
Service 是业务流程组织层。
例如:
class IndividualService
{
protected $repository;
protected $engine;
public function __construct(
IndividualRepository $repository,
IndividualEngine $engine
) {
$this->repository = $repository;
$this->engine = $engine;
}
public function getIndividual($id)
{
return $this->repository
->find($id);
}
}
Service 可以协调:
RepositoryRepository
和:
EngineEngine
但 Service 本身不应该代替 Engine 完成领域计算。
因此:
Service=BusinessFlowService=BusinessFlow
243.9 Service到Engine
如果请求涉及 ICAI 的认知、匹配、决策、行为等计算,则 Service 调用 Engine。
例如:
$result =
$this->engine
->process($individual);
形成:
Service→EngineService \rightarrow Engine
Service 提供业务上下文:
业务请求
↓
业务对象
↓
计算条件
Engine 执行:
规则
↓
计算
↓
判断
↓
结果
243.10 Engine执行领域计算
Engine 是 ICAI 的领域计算层。
例如:
Result=F(Object,Input,Rule,Condition)Result= F(Object,Input,Rule,Condition)
Engine 根据:
- Domain Object;
- 输入;
- 规则;
- 条件;
- 当前状态;
执行计算。
例如:
class IndividualEngine
{
public function process(
MachineIndividual $individual
) {
if (
$individual->getStatus()
=== 'active'
) {
return array(
'success' => true,
'state' => 'running'
);
}
return array(
'success' => false,
'state' => 'inactive'
);
}
}
这里的计算不直接操作 MySQL。
因此:
Engine≠Repository\boxed{ Engine\neq Repository }
243.11 Engine与Domain Object
Engine 处理的核心对象应该是 Domain Object。
形成:
Engine→DomainObjectEngine \rightarrow DomainObject
例如:
$individual =
$this->repository
->find($id);
$result =
$this->engine
->process($individual);
这里:
Repository
↓
Domain Object
↓
Engine
而不是:
Repository
↓
Array
↓
Engine
在 ICAI 中,Domain Object 是理论模型进入程序运行时的重要载体。
243.12 Domain Object
Domain Object 是 ICAI 领域对象在程序中的对象化表达。
例如:
class MachineIndividual
{
protected $id;
protected $name;
protected $type;
protected $status;
public function __construct(
$id,
$name,
$type,
$status
) {
$this->id = $id;
$this->name = $name;
$this->type = $type;
$this->status = $status;
}
public function getId()
{
return $this->id;
}
public function getStatus()
{
return $this->status;
}
public function setStatus($status)
{
$this->status = $status;
}
}
它不是数据库记录的简单复制。
因此:
DomainObject≠DatabaseRecord\boxed{ DomainObject\neq DatabaseRecord }
243.13 Domain Object到Repository
当 Engine 或 Service 需要读取或保存对象时,通过 Repository 完成。
查询:
Repository→DomainObjectRepository \rightarrow DomainObject
保存:
DomainObject→RepositoryDomainObject \rightarrow Repository
因此形成双向数据关系:
Repository
↓
Domain Object
↑
Repository
更完整:
MySQL→Repository→DomainObjectMySQL \rightarrow Repository \rightarrow DomainObject
以及:
DomainObject→Repository→MySQLDomainObject \rightarrow Repository \rightarrow MySQL
243.14 Repository
Repository 是 Domain Object 与持久化系统之间的访问层。
其职责包括:
Create
Find
Save
Update
Delete
例如:
$individual =
$repository->find($id);
或者:
$repository->update(
$individual
);
Repository 不负责:
用户界面
业务流程
认知计算
决策计算
行为计算
它主要负责:
PersistencePersistence
243.15 Repository到MySQL
Repository 最终通过 PDO 等数据库访问机制操作 MySQL。
形成:
Repository→PDO→MySQLRepository \rightarrow PDO \rightarrow MySQL
例如:
$sql = '
SELECT *
FROM individuals
WHERE id = :id
';
$stmt = $this->pdo->prepare($sql);
$stmt->execute(
array(':id' => $id)
);
数据库层负责:
StorageStorage
而 Repository 负责:
PersistenceAccessPersistenceAccess
因此:
Repository≠MySQLRepository\neq MySQL
243.16 MySQL数据读取
当执行查询:
SELECT *
FROM individuals
WHERE id = :id
MySQL 返回数据库记录:
id
name
type
status
但是这个结果还不是 ICAI 的 Domain Object。
因此必须经过:
DatabaseRecord→RepositoryMapping→DomainObjectDatabaseRecord \rightarrow RepositoryMapping \rightarrow DomainObject
243.17 数据记录到Domain Object
Repository 将 MySQL 数据映射成 Domain Object。
例如:
$row = $stmt->fetch(
PDO::FETCH_ASSOC
);
if (!$row) {
return null;
}
return new MachineIndividual(
$row['id'],
$row['name'],
$row['type'],
$row['status']
);
因此:
MySQLRecord→Repository→MachineIndividualMySQLRecord \rightarrow Repository \rightarrow MachineIndividual
这一步是:
DataMappingDataMapping
243.18 Domain Object状态变化
Engine 获得 Domain Object 后,可以根据 ICAI 规则计算其状态。
例如:
Statet→Engine→Statet+1State_t \rightarrow Engine \rightarrow State_{t+1}
程序:
$individual->setStatus(
'running'
);
于是:
Domain Object
状态:active
↓
Engine
↓
Domain Object
状态:running
此时改变的是:
ObjectStateObjectState
还没有改变数据库状态。
243.19 Domain Object与数据库状态
对象状态和数据库状态必须区分。
ObjectState≠DatabaseStateObjectState\neq DatabaseState
例如:
MySQL
status = active
对象加载以后:
Domain Object
status = active
Engine 计算以后:
Domain Object
status = running
此时:
MySQL
status = active
仍然没有变化。
必须通过:
Repository→MySQLRepository \rightarrow MySQL
才能完成数据库更新。
243.20 Domain Object保存
当业务确定对象状态需要持久化:
$repository->update(
$individual
);
形成:
DomainObjectt+1→Repository→MySQLDomainObject_{t+1} \rightarrow Repository \rightarrow MySQL
最终:
MySQL
status = running
于是:
ObjectState≈PersistentStateObjectState \approx PersistentState
完成同步。
243.21 数据持久化完成
完整更新过程:
MySQL
↓
Repository
↓
Domain Object
↓
Engine
↓
Domain Object状态变化
↓
Repository
↓
MySQL
数学形式:
Ot→Engine→Ot+1→Repository→DBt+1O_t \rightarrow Engine \rightarrow O_{t+1} \rightarrow Repository \rightarrow DB_{t+1}
这就是 ICAI 对象状态从读取到修改再到持久化的完整过程。
243.22 Engine返回结果
Engine 完成计算后产生结果。
例如:
EngineResult={Status,Value,Changed,Reason}EngineResult= \{ Status, Value, Changed, Reason \}
例如:
array(
'status' => 'success',
'changed' => true,
'reason' => 'state updated'
);
这个结果首先返回 Service。
因此:
Engine→ServiceEngine \rightarrow Service
243.23 Service处理Engine结果
Service 根据 EngineResult 决定业务流程。
例如:
$result =
$this->engine
->process($individual);
if ($result['changed']) {
$this->repository
->update($individual);
}
因此:
EngineResult→ServiceDecisionEngineResult \rightarrow ServiceDecision
Service 可以决定:
继续
停止
保存
回滚
返回错误
生成反馈
243.24 Service返回业务结果
Service 最终向 Controller 返回业务结果。
例如:
return array(
'success' => true,
'individual' => $individual,
'result' => $result
);
形成:
Service→BusinessResultService \rightarrow BusinessResult
此时 Controller 不需要了解 Engine 内部的计算过程。
243.25 Controller处理返回结果
Controller 获得 Service 的结果:
$result =
$this->service
->process($id);
然后将业务结果转换为 View Data:
$viewData = array(
'individual' =>
$result['individual'],
'result' =>
$result['result']
);
形成:
BusinessResult→ViewDataBusinessResult \rightarrow ViewData
243.26 View
View 是数据展示层。
在本工程体系中,可以使用 Smarty。
形成:
Controller
↓
ViewData
↓
Smarty
↓
HTML
例如:
$this->view->assign(
'individual',
$result['individual']
);
$this->view->assign(
'result',
$result['result']
);
$this->view->display(
'individual/detail.tpl'
);
View 不负责:
数据库查询
Engine计算
业务决策
领域状态修改
因此:
View≠ServiceView\neq Service
243.27 Smarty数据输出
Smarty 接收到 View Data:
individual
result
模板:
<h1>
{$individual.name}
</h1>
<p>
Type: {$individual.type}
</p>
<p>
Status: {$individual.status}
</p>
Smarty 将数据转换成 HTML。
因此:
ViewData→Smarty→HTMLViewData \rightarrow Smarty \rightarrow HTML
243.28 HTML返回Browser
最终:
Controller→View→HTML→BrowserController \rightarrow View \rightarrow HTML \rightarrow Browser
Browser 收到:
<h1>Machine Individual</h1>
<p>Status: running</p>
然后负责最终显示。
因此完整返回路径为:
MySQL→Repository→DomainObject→Engine→Service→Controller→View→Browser\boxed{ MySQL \rightarrow Repository \rightarrow DomainObject \rightarrow Engine \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Browser }
243.29 MVC完整请求流
将前面的内容合并:
Browser
↓
HTTP Request
↓
Controller
↓
Service
↓
Engine
↓
Domain Object
↓
Repository
↓
MySQL
这是:
RequestFlow\boxed{ RequestFlow }
243.30 MVC完整响应流
数据库操作完成后:
MySQL
↓
Repository
↓
Domain Object
↓
Engine
↓
Service
↓
Controller
↓
View
↓
HTML
↓
Browser
这是:
ResponseFlow\boxed{ ResponseFlow }
243.31 MVC完整双向数据流
因此完整 MVC 数据流可以表示为:
Request
↓
Browser
↓
Controller
↓
Service
↓
Engine
↓
Domain Object
↓
Repository
↓
MySQL
↑
Repository
↑
Domain Object
↑
Engine
↑
Service
↑
Controller
↓
View
↓
Browser
Response
数学表示:
Browser→Controller→Service→Engine→DomainObject→Repository→MySQL\boxed{ Browser \rightarrow Controller \rightarrow Service \rightarrow Engine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL }
再:
MySQL→Repository→DomainObject→Engine→Service→Controller→View→Browser\boxed{ MySQL \rightarrow Repository \rightarrow DomainObject \rightarrow Engine \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Browser }
243.32 一次完整ICA请求过程
假设用户请求:
GET /individual.php?id=1001
完整过程:
第一步:Browser
用户访问页面。
Browser→RequestBrowser\rightarrow Request
第二步:Controller
Controller 获取:
id=1001id=1001
第三步:Service
Service 根据业务需求调用对象服务。
第四步:Repository
Repository 查询:
SELECT *
FROM individuals
WHERE id = 1001
第五步:MySQL
MySQL 返回记录。
第六步:Domain Object
Repository 将记录转换为:
MachineIndividual
第七步:Engine
Engine 对对象进行必要计算。
第八步:Service
Service 整理业务结果。
第九步:Controller
Controller 形成:
ViewData
第十步:View
Smarty 将 View Data 转换为 HTML。
第十一步:Browser
Browser 显示最终页面。
因此:
Request→Processing→Persistence→DomainResult→View→Response\boxed{ Request \rightarrow Processing \rightarrow Persistence \rightarrow DomainResult \rightarrow View \rightarrow Response }
243.33 各层职责边界
完整 MVC 数据流中,每一层必须保持职责边界。
| 层 | 主要职责 |
|---|---|
| Browser | 用户交互、请求发送、页面显示 |
| Controller | 请求接收、参数处理、结果响应 |
| Service | 业务流程组织 |
| Engine | 领域计算、规则执行 |
| Domain Object | 领域对象与状态 |
| Repository | 持久化访问 |
| MySQL | 数据存储 |
| View | 数据呈现 |
因此:
Browser≠ControllerBrowser\neq Controller Controller≠ServiceController\neq Service Service≠EngineService\neq Engine Engine≠DomainObjectEngine\neq DomainObject DomainObject≠RepositoryDomainObject\neq Repository Repository≠MySQLRepository\neq MySQL Controller≠ViewController\neq View
243.34 ICAI完整MVC工程模型
最终形成:
┌──────────────────────┐
│ Browser │
└──────────┬───────────┘
│ Request
↓
┌──────────────────────┐
│ Controller │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ Service │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ Engine │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ Domain Object │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ Repository │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ MySQL │
└──────────────────────┘
│
│ Result
↓
Repository
↓
Domain Object
↓
Engine
↓
Service
↓
Controller
↓
View
↓
Browser
这构成 ICAI 的完整 Web MVC 数据运行结构。
243.35 MVC完整数据流与ICAI运行时
MVC 数据流不是 ICAI 理论本身,而是 ICAI 理论进入 Web 软件运行环境后的工程实现。
理论层:
Cognition→Decision→Behavior→ResultCognition \rightarrow Decision \rightarrow Behavior \rightarrow Result
工程层:
Engine→DomainObject→Repository→MySQLEngine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL
Web层:
Browser→Controller→Service→EngineBrowser \rightarrow Controller \rightarrow Service \rightarrow Engine
展示层:
Controller→View→BrowserController \rightarrow View \rightarrow Browser
因此:
ICAITheory→DomainModel→Engine→MVC→Runtime\boxed{ ICAITheory \rightarrow DomainModel \rightarrow Engine \rightarrow MVC \rightarrow Runtime }
243.36 MVC数据流中的状态变化
ICAI 运行过程中,状态可能经历:
Statet→Engine→Statet+1State_t \rightarrow Engine \rightarrow State_{t+1}
然后:
Statet+1→Repository→MySQLState_{t+1} \rightarrow Repository \rightarrow MySQL
因此完整状态链:
Statet→Calculation→Statet+1→Persistence\boxed{ State_t \rightarrow Calculation \rightarrow State_{t+1} \rightarrow Persistence }
读取时再形成:
Persistence→State→DomainObject\boxed{ Persistence \rightarrow State \rightarrow DomainObject }
这样就建立了:
MemoryState↔PersistentStateMemoryState \leftrightarrow PersistentState
之间的同步关系。
243.37 MVC数据流中的错误传播
完整数据流还必须处理异常。
例如 MySQL 连接失败:
MySQL
↓
Repository
↓
PersistenceException
↓
Service
↓
Controller
↓
Error View
↓
Browser
而业务条件不满足:
Engine
↓
BusinessResult
↓
Service
↓
Controller
↓
View
↓
Browser
两者必须区分:
BusinessFailure≠SystemExceptionBusinessFailure\neq SystemException
因此不同错误进入不同处理路径。
243.38 MVC数据流与事务
当一次请求涉及多个对象:
Browser
↓
Controller
↓
Service
↓
Transaction Begin
├── Engine
├── Domain Object A
├── Repository A
├── Domain Object B
└── Repository B
↓
Transaction Commit
↓
Controller
↓
View
↓
Browser
如果其中一步失败:
RollbackRollback
因此:
BusinessTransaction→MultiplePersistenceOperations\boxed{ BusinessTransaction \rightarrow MultiplePersistenceOperations }
事务保证同一次业务操作中的持久化一致性。
243.39 MVC完整数据流的统一数学模型
可以定义完整 MVC 数据流:
Request→C→S→E→O→R→DBRequest \rightarrow C \rightarrow S \rightarrow E \rightarrow O \rightarrow R \rightarrow DB
其中:
- CC = Controller;
- SS = Service;
- EE = Engine;
- OO = Domain Object;
- RR = Repository;
- DBDB = Database。
返回:
DB→R→O→E→S→C→V→ResponseDB \rightarrow R \rightarrow O \rightarrow E \rightarrow S \rightarrow C \rightarrow V \rightarrow Response
其中:
- VV = View。
因此:
MVCFlow=RequestFlow+DomainFlow+PersistenceFlow+ResponseFlow\boxed{ MVCFlow= RequestFlow+DomainFlow+PersistenceFlow+ResponseFlow }
243.40 MVC完整数据流与前面工程章节的统一
前面的工程章节可以统一到本章。
第236章:
ControllerController
第237章:
ModelModel
第238章:
ViewView
第239章:
Controller→ServiceController\rightarrow Service
第240章:
Service→EngineService\rightarrow Engine
第241章:
Engine→DomainObjectEngine\rightarrow DomainObject
第242章:
Repository→MySQLRepository\rightarrow MySQL
第242B章:
RepositoryInterface→RepositoryRepositoryInterface\rightarrow Repository
本章将这些关系统一为:
Browser→Controller→Service→Engine→DomainObject→RepositoryInterface→Repository→MySQL\boxed{ Browser \rightarrow Controller \rightarrow Service \rightarrow Engine \rightarrow DomainObject \rightarrow RepositoryInterface \rightarrow Repository \rightarrow MySQL }
再返回:
MySQL→Repository→DomainObject→Engine→Service→Controller→View→Browser\boxed{ MySQL \rightarrow Repository \rightarrow DomainObject \rightarrow Engine \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Browser }
243.41 ICAI MVC完整运行模型
最终,ICAI Web 系统形成以下完整运行闭环:
┌──────────────┐
│ Browser │
└──────┬───────┘
│ Request
↓
┌──────────────┐
│ Controller │
└──────┬───────┘
↓
┌──────────────┐
│ Service │
└──────┬───────┘
↓
┌──────────────┐
│ Engine │
└──────┬───────┘
↓
┌──────────────┐
│Domain Object │
└──────┬───────┘
↓
┌──────────────┐
│ Repository │
└──────┬───────┘
↓
┌──────────────┐
│ MySQL │
└──────┬───────┘
│
↓
┌──────────────┐
│ Repository │
└──────┬───────┘
↓
┌──────────────┐
│Domain Object │
└──────┬───────┘
↓
┌──────────────┐
│ Engine │
└──────┬───────┘
↓
┌──────────────┐
│ Service │
└──────┬───────┘
↓
┌──────────────┐
│ Controller │
└──────┬───────┘
↓
┌──────────────┐
│ View │
└──────┬───────┘
↓
┌──────────────┐
│ Browser │
└──────────────┘
243.42 本章总结
第243章建立了 ICAI 的完整 MVC 数据流。
从用户请求开始:
Browser→Controller→Service→Engine→DomainObject→Repository→MySQL\boxed{ Browser \rightarrow Controller \rightarrow Service \rightarrow Engine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL }
数据库处理完成以后:
MySQL→Repository→DomainObject→Engine→Service→Controller→View→Browser\boxed{ MySQL \rightarrow Repository \rightarrow DomainObject \rightarrow Engine \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Browser }
因此,ICAI 的 Web 工程运行可以统一为:
Request→Controller→Service→Engine→DomainObject→Repository→MySQL→DomainObject→Service→Controller→View→Response\boxed{ Request \rightarrow Controller \rightarrow Service \rightarrow Engine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL \rightarrow DomainObject \rightarrow Service \rightarrow Controller \rightarrow View \rightarrow Response }
其中:
Browser=用户交互入口Browser=\text{用户交互入口} Controller=请求与响应边界Controller=\text{请求与响应边界} Service=业务流程组织Service=\text{业务流程组织} Engine=领域计算Engine=\text{领域计算} DomainObject=领域对象DomainObject=\text{领域对象} Repository=持久化访问Repository=\text{持久化访问} MySQL=长期数据存储MySQL=\text{长期数据存储} View=结果呈现View=\text{结果呈现}
最终形成:
MVC完整数据流=Browser+Controller+Service+Engine+DomainObject+Repository+MySQL+View\boxed{ MVC完整数据流= Browser+Controller+Service+Engine+DomainObject+Repository+MySQL+View }
这使 ICAI 从理论对象、领域计算、对象状态、持久化数据直到用户界面形成一条完整、可追踪、可验证的工程数据链。