首页 理论 架构 工程 文档 白皮书 著作 研究 案例 下载 博客 关于 开始使用 →

第二十一章 WSaiOS-ICAI 学习系统工程 PHP OOP 完整实现模型

第二十一章 WSaiOS-ICAI 学习系统工程 PHP OOP 完整实现模型

(PHP OOP Complete Implementation Model)


21.1 工程实现目标

前面章节完成了:

  • 学习动力模型;
  • 学习触发模型;
  • 学习类型模型;
  • 学习方法模型;
  • 学习反馈模型;
  • 能力成长模型。

本章进入:

WSaiOS-ICAI 学习系统工程实现层。


工程目标:

将学习行为转换为:

  • 类(Class);
  • 对象(Object);
  • 属性(Property);
  • 方法(Method);
  • 接口(Interface);
  • 服务(Service)。

核心思想:

用面向对象方式模拟个体学习行为。


21.2 学习系统对象体系

整体对象关系:

LearningKernel
|
LearningManager
|
LearningTask
|
┌──────────────┼──────────────┐
| | |
LearningMethod LearningEngine Feedback
| | |
└──────────────┼──────────────┘
|
AbilityUpdate
|
Experience

21.3 基础抽象接口设计

不同学习类型:

具有共同特点。

例如:

主动学习:

产生需求
执行学习
反馈结果

实时学习:

检测问题
获取信息
解决问题

教育学习:

接收输入
理解内容
形成能力

因此设计:

Learning Interface。


interface LearningInterface
{
public function trigger();
public function execute();
public function feedback();
}

含义:

所有学习行为:

必须具有:

  • 触发;
  • 执行;
  • 反馈。

21.4 主动学习引擎实现

ActiveLearningEngine:

class ActiveLearningEngine implements LearningInterface
{
private $task;
public function trigger()
{
}
public function execute()
{
}
public function feedback()
{
}
}

逻辑:

任务需求
能力检测
发现不足
启动学习

21.5 实时学习引擎实现

RealtimeLearningEngine:

class RealtimeLearningEngine implements LearningInterface
{
private $decision;
private $information;
public function trigger()
{
}
public function execute()
{
}
public function feedback()
{
}
}

逻辑:

决策
信息不足
实时获取
支持决策

21.6 兴趣学习引擎实现

InterestLearningEngine:

class InterestLearningEngine implements LearningInterface
{
private $interest;
public function trigger()
{
}
public function execute()
{
}
public function feedback()
{
}
}

逻辑:

兴趣对象
探索
扩展认知

21.7 教育学习引擎实现

EducationLearningEngine:

class EducationLearningEngine implements LearningInterface
{
private $course;
private $teacher;
public function trigger()
{
}
public function execute()
{
}
public function feedback()
{
}
}

逻辑:

外部输入
课程学习
能力形成

21.8 经验学习引擎实现

ExperienceLearningEngine:

class ExperienceLearningEngine implements LearningInterface
{
private $experience;
public function trigger()
{
}
public function execute()
{
}
public function feedback()
{
}
}

逻辑:

过去结果
经验分析
行为优化

21.9 Learning Factory(学习工厂)

五种学习方式:

由统一入口创建。


class LearningFactory
{
public function create($type)
{
switch($type)
{
case “active”:
return new ActiveLearningEngine();
case “realtime”:
return new RealtimeLearningEngine();
case “interest”:
return new InterestLearningEngine();
case “education”:
return new EducationLearningEngine();
case “experience”:
return new ExperienceLearningEngine();
}
}
}

作用:

根据学习类型:

创建对应学习对象。


21.10 Learning Kernel 调用流程

class LearningKernel
{
private $factory;
public function start($type)
{
$engine = $this->factory->create($type);
$engine->trigger();
$engine->execute();
$engine->feedback();
}
}

运行:

输入学习需求
Kernel
Factory
Learning Engine
Feedback

21.11 学习任务对象完整设计

class LearningTask
{
private $id;
private $goal;
private $type;
private $priority;
private $status;
public function setGoal($goal)
{
}
public function getGoal()
{
}
}

示例:

创建任务:

$task = new LearningTask();
$task->setGoal(
“学习数据库优化”
);

21.12 学习状态对象

class LearningState
{
private $state;
public function change($state)
{
$this->state=$state;
}
}

状态:

CREATED
LEARNING
PRACTICE
EVALUATION
COMPLETE

21.13 Service 层设计

MVC 中:

业务逻辑放 Service。

结构:

Service/
LearningService.php
TriggerService.php
MethodService.php
FeedbackService.php
AbilityService.php

例如:

LearningService:

class LearningService
{
public function startLearning($task)
{
}
}

21.14 Controller 层设计

控制用户请求。

例如:

LearningController。

class LearningController
{
public function start()
{
}
public function status()
{
}
}

功能:

  • 开始学习;
  • 查看状态;
  • 获取结果。

21.15 Smarty View设计

目录:

View/
learning/
index.tpl
task.tpl
result.tpl

index.tpl:

<h1>
WSaiOS-ICAI 学习系统
</h1>
<p>
当前学习任务:
{$task}
</p>
<p>
学习类型:
{$type}
</p>
<p>
状态:
{$status}
</p>

21.16 完整运行流程实例

输入:

我要开发一个企业管理系统

能力检测:

缺少架构设计能力

触发:

主动学习

创建任务:

学习软件架构设计

选择方法:

查找
阅读
分析
实践

执行:

完成学习

反馈:

架构能力提升

经验:

大型系统需要先设计整体结构

最终:

更新:

Ability:
系统架构能力 +1

21.17 本章总结

第二十一章完成:

WSaiOS-ICAI 学习系统 PHP OOP 工程基础。

形成:

学习需求
LearningKernel
LearningFactory
LearningEngine
LearningMethod
Feedback
Ability
Experience

工程特点:

  • 不依赖大模型逻辑;
  • 不采用预测式学习;
  • 采用对象属性方法模型;
  • 采用符号规则驱动;
  • PHP OOP实现;
  • MVC分层;
  • Smarty界面。

Leave a Reply

Your email address will not be published. Required fields are marked *