第四章 方法理论
4.1 Method的定义
在WSaiOS结构智能(WSaiOS-SI)理论中,Method(方法)是结构智能由“能够完成什么”进入“具体如何完成”的关键结构。
前面的理论已经建立:
Knowledge→CognitionKnowledge\rightarrow Cognition Cognition→CapabilityCognition\rightarrow Capability Capability→DecisionCapability\rightarrow Decision
而决策形成以后,还需要解决一个问题:
决定以后,按照什么结构路径完成任务?
因此:
Decision→MethodDecision\rightarrow Method
Method不是简单的一段程序,也不是普通意义上的操作步骤。
在结构智能中,Method是一种具有目标、输入、条件、知识、能力、规则、步骤、输出和验证关系的执行结构。
可以定义为:
Method是为了实现特定目标,在给定输入、对象、条件和约束下,组织知识、能力、规则和运算,并按照确定的结构路径产生结果的执行结构。
其基本形式为:
Method=Goal+Input+Object+Condition+Knowledge+Capability+Rule+Operation+Step+Output+Validation\boxed{ Method= Goal+ Input+ Object+ Condition+ Knowledge+ Capability+ Rule+ Operation+ Step+ Output+ Validation }
因此,Method的核心不是“做了什么动作”,而是:
如何组织已有结构,使目标能够通过一条确定的执行路径得到结果。
4.2 Method在结构智能中的位置
Method处于决策与行动之间,但它并不是孤立存在的。
完整关系为:
Knowledge→Cognition→Capability→Decision→Method→ActionKnowledge \rightarrow Cognition \rightarrow Capability \rightarrow Decision \rightarrow Method \rightarrow Action
其中:
Knowledge
解决:
知道什么。
Cognition
解决:
当前是什么。
Capability
解决:
能够完成什么任务。
Decision
解决:
当前选择什么。
Method
解决:
选择以后如何完成。
Action
解决:
实际执行什么。
因此:
Knowledge≠Cognition≠Capability≠Decision≠Method≠Action\boxed{ Knowledge\neq Cognition\neq Capability\neq Decision\neq Method\neq Action }
这些结构虽然连续,但具有不同的理论职责。
4.3 Method不是Operation
必须首先明确:
Method≠OperationMethod\neq Operation
Operation(运算)是具体处理。
例如:
Compare(29.99,39.99)Compare(29.99,39.99)
属于一个比较运算。
而:
SelectLowestPriceProductSelectLowestPriceProduct
则可能是一个更高层的方法。
该方法可能包含:
Filter→Compare→Sort→Select→VerifyFilter \rightarrow Compare \rightarrow Sort \rightarrow Select \rightarrow Verify
因此:
Method→Operation1→Operation2→Operation3Method \rightarrow Operation_1 \rightarrow Operation_2 \rightarrow Operation_3
方法组织运算。
运算执行具体处理。
所以:
Operation是方法中的具体执行单元,Method是组织多个执行单元实现目标的结构。
4.4 Method不是Capability
同样:
Method≠CapabilityMethod\neq Capability
能力回答:
能够完成什么。
方法回答:
按照什么结构路径完成。
例如:
Capability=ProductSelectionCapabilityCapability=ProductSelectionCapability
表示系统具有:
从多个产品中完成选择的能力。
但是具体如何选择,可以存在:
Method1=LowestPriceMethodMethod_1=LowestPriceMethod Method2=HighestQualityMethodMethod_2=HighestQualityMethod Method3=BalancedSelectionMethodMethod_3=BalancedSelectionMethod
因此:
Capability→MethodCapability \rightarrow Method
能力可以调用一个或者多个方法。
所以:
Capability≠Method\boxed{ Capability\neq Method }
4.5 两个层次的Method
在WSaiOS-SI理论中,需要特别区分两种Method:
类中的Method\boxed{ 类中的Method }
与:
解决问题层面的Method\boxed{ 解决问题层面的Method }
二者都称为Method,但处于不同结构层级。
类中的Method属于对象结构内部的执行结构。
解决问题层面的Method属于更高层的任务执行结构。
因此:
ClassMethod≠ProblemSolvingMethodClassMethod \neq ProblemSolvingMethod
但是二者并不是完全割裂的。
更准确的关系是:
ProblemSolvingMethod→Capability→ClassMethod→Operation\boxed{ ProblemSolvingMethod \rightarrow Capability \rightarrow ClassMethod \rightarrow Operation }
或者:
高层Method组织底层Method完成任务\boxed{ 高层Method 组织底层Method完成任务 }
这正是本章需要建立的核心理论。
4.6 类中的Method
在面向对象结构中,一个Class通常包含:
Class={Attribute,Method}Class= \{ Attribute, Method \}
例如:
ProductClassProductClass
可以具有:
Attribute={Price,Brand,Function}Attribute= \{ Price, Brand, Function \}
同时具有:
Method={ComparePrice(),CheckFunction(),Verify()}Method= \{ ComparePrice(), CheckFunction(), Verify() \}
这些Method属于Product类自身。
当类被实例化以后:
ProductClass→ProductObjectProductClass \rightarrow ProductObject
类中的Method也可以针对具体对象实例执行:
ProductObject→MethodInstanceProductObject \rightarrow MethodInstance
例如:
ProductA.ComparePrice()ProductA.ComparePrice()
这里的Method直接作用于ProductA对象。
因此:
ClassMethod→ObjectInstance→Operation\boxed{ ClassMethod \rightarrow ObjectInstance \rightarrow Operation }
4.7 类中的Method作用于对象属性
类中的Method与对象属性具有直接关系。
例如:
Product={Price,Quality,Function}Product = \{ Price, Quality, Function \}
定义:
ComparePrice()ComparePrice()
它可以访问:
Product.PriceProduct.Price
并进行:
Compare(ProductA.Price,ProductB.Price)Compare(ProductA.Price,ProductB.Price)
因此:
Object→Attribute→MethodObject \rightarrow Attribute \rightarrow Method
或者:
Method→Object.AttributeMethod \rightarrow Object.Attribute
方法可以对对象属性值进行处理。
这与WSaiOS-SI的基础结构:
Element→Object→Attribute→Value→MethodElement \rightarrow Object \rightarrow Attribute \rightarrow Value \rightarrow Method
保持一致。
4.8 类中的Method具有对象上下文
类中的Method通常不是脱离对象独立运行的。
例如:
ProductA.Verify()ProductA.Verify()
其中:
ProductAProductA
就是Method执行的对象上下文。
Method可以直接访问:
ProductA.PriceProductA.Price ProductA.FunctionProductA.Function ProductA.BrandProductA.Brand
因此:
MethodInstance=Method+ObjectInstanceMethodInstance= Method+ ObjectInstance
进一步,如果存在参数:
MethodInstance=Method+ObjectInstance+ParametersMethodInstance= Method+ ObjectInstance+ Parameters
这就是方法实例化。
4.9 解决问题层面的Method
高层解决问题的Method与类中的Method不同。
它面对的不是一个简单对象,而是一个完整问题。
例如:
从多个电动牙刷中选择价格最低且支持充电的产品。
这是一个任务。
解决这个任务的方法可以是:
LowestChargingProductMethodLowestChargingProductMethod
其结构可能为:
IdentifyCandidates→FilterCharging→CheckPrice→SortPrice→Select→VerifyIdentifyCandidates \rightarrow FilterCharging \rightarrow CheckPrice \rightarrow SortPrice \rightarrow Select \rightarrow Verify
这里的方法已经不是某个Product类内部的单一Method。
它是一个任务级方法。
因此:
ProblemSolvingMethod=对多个能力、知识、对象、类Method和运算进行组织的执行结构\boxed{ ProblemSolvingMethod = 对多个能力、知识、对象、类Method和运算进行组织的执行结构 }
4.10 两种Method的层级差异
两种Method可以表示为:
ClassMethodClassMethod
属于:
Object/Class StructureObject/Class\ Structure
而:
ProblemSolvingMethodProblemSolvingMethod
属于:
Capability/Decision/Task StructureCapability/Decision/Task\ Structure
因此:
ClassMethod→对象内部执行\boxed{ ClassMethod\rightarrow对象内部执行 } ProblemSolvingMethod→问题整体执行\boxed{ ProblemSolvingMethod\rightarrow问题整体执行 }
类中的Method解决一个结构内部的问题。
高层Method解决一个任务整体的问题。
4.11 两种Method并不是两个完全独立的系统
虽然两个层次不同,但它们之间必须能够衔接。
例如:
高层任务:
选择价格最低且支持充电的产品。
高层Method:
SelectProductMethodSelectProductMethod
它可能组织:
GetProductsGetProducts CheckChargingCheckCharging ComparePriceComparePrice VerifySelectionVerifySelection
而这些又可能调用类中的Method:
Product.GetFunction()Product.GetFunction() Product.GetPrice()Product.GetPrice() Product.CheckCharging()Product.CheckCharging() Product.ComparePrice()Product.ComparePrice()
于是形成:
ProblemSolvingMethod→ClassMethod→Operation\boxed{ ProblemSolvingMethod \rightarrow ClassMethod \rightarrow Operation }
这就是两种Method之间的核心衔接关系。
4.12 高层Method调用类中的Method
一个问题级Method可以调用多个对象的类Method。
例如:
ProductA.CheckCharging()ProductA.CheckCharging()
得到:
TrueTrue
然后:
ProductA.GetPrice()ProductA.GetPrice()
得到:
29.9929.99
对ProductB执行:
ProductB.CheckCharging()ProductB.CheckCharging()
以及:
ProductB.GetPrice()ProductB.GetPrice()
得到:
39.9939.99
高层Method获得这些结果以后继续执行:
Compare()Compare()
然后:
Select()Select()
因此:
ProblemSolvingMethod→Object→ClassMethod→Result→HigherLevelMethod\boxed{ ProblemSolvingMethod \rightarrow Object \rightarrow ClassMethod \rightarrow Result \rightarrow HigherLevelMethod }
4.13 Method实例化
无论是类中的Method还是高层Method,都需要从抽象结构进入具体执行。
因此:
Method→MethodInstanceMethod \rightarrow MethodInstance
例如:
ComparePriceComparePrice
是抽象Method。
当应用于:
ProductAProductA
和:
ProductBProductB
以后:
ComparePrice(ProductA,ProductB)ComparePrice(ProductA,ProductB)
形成具体的MethodInstance。
更完整地:
MethodInstance=Method+Object+Input+Parameters+ConditionMethodInstance= Method+ Object+ Input+ Parameters+ Condition
然后:
MethodInstance→OperationMethodInstance \rightarrow Operation
4.14 高层Method的组成
解决问题层面的Method可以表示为:
PM={Goal,Input,Requirement,Knowledge,Capability,Object,Condition,Constraint,SubMethod,Rule,Operation,Output,Validation}PM= \{ Goal, Input, Requirement, Knowledge, Capability, Object, Condition, Constraint, SubMethod, Rule, Operation, Output, Validation \}
其中:
Goal
定义任务最终需要实现什么。
Input
定义需要处理的输入。
Requirement
定义问题要求。
Knowledge
提供解决问题所需要的知识。
Capability
提供执行任务所需要的能力。
Object
提供具体处理对象。
Condition
定义执行条件。
Constraint
定义执行边界。
SubMethod
定义具体执行步骤。
Rule
规定步骤之间的判断逻辑。
Operation
执行具体计算。
Output
产生阶段性或最终结果。
Validation
验证结果。
因此:
ProblemSolvingMethod=Goal+Input+Knowledge+Capability+Object+Condition+Constraint+SubMethod+Rule+Operation+Output+Validation\boxed{ ProblemSolvingMethod = Goal+ Input+ Knowledge+ Capability+ Object+ Condition+ Constraint+ SubMethod+ Rule+ Operation+ Output+ Validation }
4.15 高层Method不是简单步骤列表
解决问题的方法虽然可以表现为步骤,但它本质上不是普通的流程清单。
例如:
Step1→Step2→Step3Step_1 \rightarrow Step_2 \rightarrow Step_3
如果只是固定步骤,并不能形成真正的结构智能方法。
因为实际执行过程中可能发生:
Condition=TrueCondition=True
或者:
Condition=FalseCondition=False
于是需要不同路径:
Method→Condition→PathAMethod \rightarrow Condition \rightarrow Path_A
或者:
Method→Condition→PathBMethod \rightarrow Condition \rightarrow Path_B
因此高层Method必须能够包含:
- 条件;
- 判断;
- 分支;
- 循环;
- 方法调用;
- 能力调用;
- 参数传递;
- 结果反馈;
- 错误处理;
- 重新执行。
所以:
ProblemSolvingMethodProblemSolvingMethod
本质上是一个可执行的结构路径。
4.16 Method与能力的衔接
前面的能力理论已经确定:
Capability≠MethodCapability \neq Method
但二者必须衔接。
能力负责确定:
当前能够完成什么任务。
Method负责确定:
当前任务按照什么路径完成。
因此:
Capability→MethodSelectionCapability \rightarrow MethodSelection
例如:
Capability=ProductSelectionCapabilityCapability=ProductSelectionCapability
根据当前目标:
Goal=LowestPriceGoal=LowestPrice
选择:
Method=LowestPriceSelectionMethodMethod=LowestPriceSelectionMethod
然后:
Method→MethodInstantiation→ExecutionMethod \rightarrow MethodInstantiation \rightarrow Execution
所以:
Capability→Method\boxed{ Capability\rightarrow Method }
是从“能力”进入“执行”的关键关系。
4.17 Method与决策的衔接
前一章已经建立:
DecisionCapability→DecisionDecisionCapability \rightarrow Decision
决策形成以后,需要选择执行方法:
Decision→MethodDecision \rightarrow Method
例如:
Decision=Select(ProductA)Decision=Select(ProductA)
下一步可能需要:
PurchaseProductMethodPurchaseProductMethod
于是:
Decision→MethodSelection→MethodInstance→ActionDecision \rightarrow MethodSelection \rightarrow MethodInstance \rightarrow Action
因此:
决策确定选择结果,方法确定如何实现这个选择。
这使:
Decision≠MethodDecision\neq Method
成为明确的理论边界。
4.18 Method与知识的衔接
Method本身也需要知识。
例如:
PurchaseProductMethodPurchaseProductMethod
需要知道:
- Product;
- Price;
- Stock;
- Supplier;
- Payment;
- Delivery。
因此:
Method→KnowledgeCallMethod \rightarrow KnowledgeCall
如果缺少必要知识:
KnowledgeMissingKnowledgeMissing
方法就不能完整执行。
因此:
Method→Knowledge→Object→Attribute→ValueMethod \rightarrow Knowledge \rightarrow Object \rightarrow Attribute \rightarrow Value
然后:
Value→OperationValue \rightarrow Operation
形成:
Method→Knowledge→OperationMethod \rightarrow Knowledge \rightarrow Operation
4.19 Method与能力调用
高层Method可以组织多个能力。
例如:
SelectProductMethodSelectProductMethod
可能调用:
ProductRecognitionCapabilityProductRecognitionCapability PriceComparisonCapabilityPriceComparisonCapability ConditionVerificationCapabilityConditionVerificationCapability
最终:
SelectProductMethod→C1→C2→C3SelectProductMethod \rightarrow C_1 \rightarrow C_2 \rightarrow C_3
因此:
ProblemSolvingMethod→Capability→Method\boxed{ ProblemSolvingMethod \rightarrow Capability \rightarrow Method }
这里形成一种层级关系:
高层Method调用能力。
能力再选择或调用底层Method。
底层Method最终执行具体Operation。
因此:
HighLevelMethod→Capability→Method→Operation\boxed{ HighLevelMethod \rightarrow Capability \rightarrow Method \rightarrow Operation }
这是WSaiOS-SI中方法层的重要结构。
4.20 方法的层级结构
因此,WSaiOS-SI中的Method可以形成多层结构。
第一层:
ClassMethodClassMethod
作用于对象内部结构。
第二层:
CapabilityMethodCapabilityMethod
服务于某项能力的执行。
第三层:
ProblemSolvingMethodProblemSolvingMethod
组织多个能力和方法解决完整任务。
第四层:
CompositeMethodCompositeMethod
进一步组织多个问题解决方法完成复杂任务。
于是:
ClassMethod→CapabilityMethod→ProblemSolvingMethod→CompositeMethod\boxed{ ClassMethod \rightarrow CapabilityMethod \rightarrow ProblemSolvingMethod \rightarrow CompositeMethod }
这并不是说必须存在固定四层,而是说明Method可以随着任务复杂度形成层级和组合。
4.21 Method的组合
多个Method可以组成新的Method。
例如:
MethodA=InformationAcquisitionMethod_A=InformationAcquisition MethodB=StructureMatchingMethod_B=StructureMatching MethodC=KnowledgeEvaluationMethod_C=KnowledgeEvaluation
可以形成:
MethodABC=MethodA→MethodB→MethodCMethod_{ABC} = Method_A \rightarrow Method_B \rightarrow Method_C
因此:
Method+Method→CompositeMethod\boxed{ Method + Method \rightarrow CompositeMethod }
只要前一个Method的输出能够成为后一个Method的输入,就可以形成方法链。
即:
Output(Mi)→Input(Mi+1)Output(M_i) \rightarrow Input(M_{i+1})
4.22 Method的参数传递
方法之间需要参数传递。
例如:
MethodAMethod_A
产生:
ProductListProductList
然后:
MethodBMethod_B
需要:
ProductListProductList
于是:
Output(MethodA)→Parameter(MethodB)Output(Method_A) \rightarrow Parameter(Method_B)
形成:
MethodA→MethodBMethod_A \rightarrow Method_B
更完整地:
Method→ParameterBinding→OperationMethod \rightarrow ParameterBinding \rightarrow Operation
参数可以来自:
- 需求;
- 对象属性;
- 知识;
- 前一个Method的结果;
- 能力输出;
- 运算结果;
- 当前场景状态。
因此:
ParameterParameter
本身也是方法执行结构的重要组成部分。
4.23 Method的条件执行
方法不一定按照固定路径执行。
例如:
CheckStock()CheckStock()
如果:
Stock=TrueStock=True
则:
Purchase()Purchase()
如果:
Stock=FalseStock=False
则:
FindAlternative()FindAlternative()
于是:
Method→Condition→BranchMethod \rightarrow Condition \rightarrow Branch
可以表示为:
M={M1,Condition=TrueM2,Condition=FalseM= \begin{cases} M_1,&Condition=True\\ M_2,&Condition=False \end{cases}
因此,高层Method可以根据当前知识、对象状态和场景动态选择执行路径。
4.24 Method与状态
Method的执行不能脱离当前对象状态。
例如:
Product.State=AvailableProduct.State=Available
可以执行:
PurchaseMethodPurchaseMethod
如果:
Product.State=OutOfStockProduct.State=OutOfStock
则:
PurchaseMethodPurchaseMethod
可能无法继续。
因此:
Method→StateCheck→ExecutionMethod \rightarrow StateCheck \rightarrow Execution
状态本身可以来自认知:
Cognition→StateCognition \rightarrow State
再进入方法:
State→MethodSelectionState \rightarrow MethodSelection
所以:
当前状态决定方法是否能够执行以及选择哪种方法\boxed{ 当前状态决定方法是否能够执行以及选择哪种方法 }
4.25 Method与场景
解决问题的方法必须适应当前场景。
同一个目标:
获得某个产品。
在不同场景下可能使用不同方法。
例如:
SceneA→PurchaseMethodScene_A \rightarrow PurchaseMethod
而:
SceneB→FindSupplierMethodScene_B \rightarrow FindSupplierMethod
因此:
MethodSelection=f(Goal,Condition,Constraint,Scene)MethodSelection = f(Goal,Condition,Constraint,Scene)
方法不是脱离场景固定运行的。
4.26 Method与决策能力
决策能力可以选择方法。
例如:
DecisionCapabilityDecisionCapability
发现存在:
MethodAMethod_A
和:
MethodBMethod_B
两种方法都可以完成任务。
系统根据:
ConditionCondition
以及:
ConstraintConstraint
进行方法选择:
Method∗=Select(MethodA,MethodB)Method^* = Select(Method_A,Method_B)
然后:
Method∗→MethodInstanceMethod^* \rightarrow MethodInstance
因此:
DecisionCapability→MethodSelection\boxed{ DecisionCapability \rightarrow MethodSelection }
这是决策能力与方法理论的重要连接。
4.27 Method与决策结果
决策确定具体选择以后,方法负责执行这个选择。
例如:
Decision=Select(ProductA)Decision=Select(ProductA)
形成:
Purchase(ProductA)Purchase(ProductA)
但Purchase不是决策本身。
它是:
MethodMethod
方法可能继续调用:
CheckPrice(ProductA)CheckPrice(ProductA) CheckStock(ProductA)CheckStock(ProductA) CreateOrder(ProductA)CreateOrder(ProductA) VerifyOrder(ProductA)VerifyOrder(ProductA)
因此:
Decision→Method→SubMethod→OperationDecision \rightarrow Method \rightarrow SubMethod \rightarrow Operation
形成完整执行结构。
4.28 Method与Action
Method是行动的结构基础。
Method→ActionMethod \rightarrow Action
但:
Method≠ActionMethod\neq Action
方法描述:
如何执行。
行动表示:
实际执行。
例如:
Method=PurchaseProductMethod=PurchaseProduct
经过实例化:
PurchaseProduct(ProductA)PurchaseProduct(ProductA)
再进入实际执行:
Action=Purchase(ProductA)Action=Purchase(ProductA)
所以:
Method→MethodInstance→Action\boxed{ Method \rightarrow MethodInstance \rightarrow Action }
4.29 Method执行后的反馈
方法执行以后会产生结果。
Method→Action→ResultMethod \rightarrow Action \rightarrow Result
结果进入验证:
Result→ValidationResult \rightarrow Validation
再产生:
FeedbackFeedback
形成:
Method→Action→Result→Validation→FeedbackMethod \rightarrow Action \rightarrow Result \rightarrow Validation \rightarrow Feedback
如果成功:
Feedback=SuccessFeedback=Success
则当前方法可以继续作为稳定的方法结构使用。
如果失败:
Feedback=FailureFeedback=Failure
则可能需要:
MethodRevisionMethodRevision
或者:
CapabilityRevisionCapabilityRevision
或者:
KnowledgeUpdateKnowledgeUpdate
4.30 Method的形成
方法也不是天然存在的。
一个新的方法可以从稳定的解决问题过程抽象出来。
例如多次执行:
CheckCondition→GetValue→Compare→Select→VerifyCheckCondition \rightarrow GetValue \rightarrow Compare \rightarrow Select \rightarrow Verify
如果这一结构能够稳定解决某一类问题,就可以抽象为:
Method=ConditionalSelectionMethod=ConditionalSelection
因此:
RepeatedProblemSolving→StructureExtraction→MethodFormation\boxed{ RepeatedProblemSolving \rightarrow StructureExtraction \rightarrow MethodFormation }
方法形成以后,可以被保存为可复用结构。
下一次遇到相似问题:
RequirementMatch→MethodReuseRequirementMatch \rightarrow MethodReuse
从而避免重新构建完整执行路径。
4.31 Method的复用
方法的一个重要特征是可复用。
例如:
ComparePriceMethodComparePriceMethod
可以用于:
ProductA/ProductBProductA/ProductB
也可以用于:
ProductC/ProductDProductC/ProductD
因为方法本身不是某一次具体比较结果,而是一个抽象执行结构。
因此:
Method+NewObject→NewMethodInstanceMethod + NewObject \rightarrow NewMethodInstance
形成:
MethodReuseMethodReuse
这与知识结构和能力结构的复用性质一致。
4.32 Method的泛化
如果一个方法只针对:
ProductAProductA
它的复用范围非常有限。
如果抽象为:
ComparePrice(ProductX,ProductY)ComparePrice(ProductX,ProductY)
则可以应用于任意满足结构要求的对象。
因此:
SpecificMethod→AbstractMethodSpecificMethod \rightarrow AbstractMethod
形成:
MethodGeneralizationMethodGeneralization
其基础是:
ObjectStructure+AttributeStructure+OperationStructureObjectStructure + AttributeStructure + OperationStructure
能够保持稳定。
4.33 Method与知识学习
方法也可以产生知识需求。
例如方法需要:
QualityQuality
但是当前知识结构中不存在:
QualityQuality
于是:
Method→KnowledgeRequirementMethod \rightarrow KnowledgeRequirement
形成:
KnowledgeGapKnowledgeGap
再进入:
KnowledgeAcquisitionKnowledgeAcquisition
因此:
Method→KnowledgeRequirement→Learning\boxed{ Method \rightarrow KnowledgeRequirement \rightarrow Learning }
这说明方法不仅使用知识,也可以反向确定需要什么知识。
4.34 Method与能力形成
一个方法稳定以后,也可以帮助形成新的能力。
例如:
Method=Filter→Compare→Sort→VerifyMethod= Filter \rightarrow Compare \rightarrow Sort \rightarrow Verify
如果这一方法能够稳定解决:
从多个候选对象中选择符合条件的最佳对象。
则可以形成:
Capability=CandidateSelectionCapabilityCapability=CandidateSelectionCapability
于是:
Method→CapabilityFormationMethod \rightarrow CapabilityFormation
反过来:
Capability→MethodSelectionCapability \rightarrow MethodSelection
形成:
Capability↔Method\boxed{ Capability \leftrightarrow Method }
但是二者仍然不是同一个概念。
4.35 两种Method的统一理论
经过上述分析,可以将:
ClassMethodClassMethod
与:
ProblemSolvingMethodProblemSolvingMethod
统一到同一个Method理论中。
二者共同具有:
GoalGoal InputInput ObjectObject ConditionCondition ParameterParameter OperationOperation OutputOutput ValidationValidation
区别只是作用层级不同。
类中的Method:
MethodClassMethod_{Class}
主要作用于:
Class/ObjectClass/Object
解决对象内部结构处理问题。
问题解决Method:
MethodProblemMethod_{Problem}
主要作用于:
Requirement/Capability/Decision/SceneRequirement/Capability/Decision/Scene
解决完整任务问题。
因此:
MethodClass⊂MethodExecutionStructure\boxed{ Method_{Class} \subset Method_{ExecutionStructure} }
而:
MethodProblem=MethodExecutionStructure at higher task level\boxed{ Method_{Problem} = Method_{ExecutionStructure} \text{ at higher task level} }
二者都属于Method,只是抽象层次和作用范围不同。
4.36 两种Method的衔接模型
最终可以形成:
ProblemSolvingMethod→Capability→Object→ClassMethod→Operation\boxed{ ProblemSolvingMethod \rightarrow Capability \rightarrow Object \rightarrow ClassMethod \rightarrow Operation }
例如:
问题
选择价格最低的产品。
高层Method
SelectLowestPriceProductSelectLowestPriceProduct
调用能力
ProductSelectionCapabilityProductSelectionCapability
获取对象
ProductA,ProductB,ProductCProductA,ProductB,ProductC
调用类Method
Product.GetPrice()Product.GetPrice()
得到属性值
29.99, 39.99, 25.9929.99,\ 39.99,\ 25.99
执行运算
Sort(Price)Sort(Price)
得到结果
ProductCProductC
验证
Verify(ProductC)Verify(ProductC)
最终:
Decision=ProductCDecision=ProductC
因此整个结构为:
ProblemSolvingMethod→Capability→ClassMethod→Operation→Result\boxed{ ProblemSolvingMethod \rightarrow Capability \rightarrow ClassMethod \rightarrow Operation \rightarrow Result }
这就是高层Method与类Method之间的实际衔接。
4.37 Method的统一执行链
综合本章内容,Method可以形成统一执行链:
Requirement→Goal→Capability→Decision→MethodSelection→MethodInstantiation→ObjectBinding→ParameterBinding→ClassMethod→Operation→Result→Validation→Action\boxed{ Requirement \rightarrow Goal \rightarrow Capability \rightarrow Decision \rightarrow MethodSelection \rightarrow MethodInstantiation \rightarrow ObjectBinding \rightarrow ParameterBinding \rightarrow ClassMethod \rightarrow Operation \rightarrow Result \rightarrow Validation \rightarrow Action }
其中:
ProblemSolvingMethodProblemSolvingMethod
位于高层:
Decision→ProblemSolvingMethodDecision \rightarrow ProblemSolvingMethod
而:
ClassMethodClassMethod
位于具体执行层:
Object→ClassMethod→OperationObject \rightarrow ClassMethod \rightarrow Operation
二者通过:
CapabilityCapability
和:
ObjectObject
建立连接。
4.38 Method与结构智能完整闭环
将本章放回WSaiOS-SI完整理论体系,可以得到:
Information→Element→Structure→KnowledgeMatching→SemanticUnderstanding→CognitionInformation \rightarrow Element \rightarrow Structure \rightarrow KnowledgeMatching \rightarrow SemanticUnderstanding \rightarrow Cognition
然后:
Cognition→Capability→DecisionCapability→DecisionCognition \rightarrow Capability \rightarrow DecisionCapability \rightarrow Decision
再:
Decision→ProblemSolvingMethod→Capability→ClassMethod→Operation→ActionDecision \rightarrow ProblemSolvingMethod \rightarrow Capability \rightarrow ClassMethod \rightarrow Operation \rightarrow Action
最终:
Action→WorldChange→Feedback→SceneUpdate→ReCognitionAction \rightarrow WorldChange \rightarrow Feedback \rightarrow SceneUpdate \rightarrow ReCognition
形成完整循环:
Information→Knowledge→Cognition→Capability→Decision→ProblemSolvingMethod→ClassMethod→Operation→Action→Feedback→ReCognition\boxed{ Information \rightarrow Knowledge \rightarrow Cognition \rightarrow Capability \rightarrow Decision \rightarrow ProblemSolvingMethod \rightarrow ClassMethod \rightarrow Operation \rightarrow Action \rightarrow Feedback \rightarrow ReCognition }
这使Method成为从抽象问题解决能力到具体对象执行结构之间的桥梁。
4.39 本章理论结论
本章建立了WSaiOS-SI中的Method理论,并解决了两个不同层级Method之间的关系。
首先,Method定义为:
Method=Goal+Input+Object+Condition+Knowledge+Capability+Rule+Operation+Step+Output+Validation\boxed{ Method= Goal+ Input+ Object+ Condition+ Knowledge+ Capability+ Rule+ Operation+ Step+ Output+ Validation }
Method不是单纯的运算,也不是单纯的步骤列表。
它是一个能够围绕目标组织知识、能力、对象、规则和运算,并形成执行路径的结构。
其次,明确:
Capability≠Method\boxed{ Capability\neq Method }
能力回答:
能够完成什么。
方法回答:
按照什么路径完成。
同时:
Method≠Operation\boxed{ Method\neq Operation }
方法组织运算,运算执行具体处理。
再次,本章区分两个层次:
ClassMethod\boxed{ ClassMethod }
与:
ProblemSolvingMethod\boxed{ ProblemSolvingMethod }
类中的Method属于对象结构内部,用于处理对象属性和执行对象相关操作。
解决问题层面的Method属于更高层任务结构,用于组织知识、能力、对象、类Method、运算和验证,以完成完整问题。
二者并不是两个互相独立的Method体系,而是:
ProblemSolvingMethod→Capability→Object→ClassMethod→Operation\boxed{ ProblemSolvingMethod \rightarrow Capability \rightarrow Object \rightarrow ClassMethod \rightarrow Operation }
因此,高层Method可以调用能力,能力可以调用具体Method,具体Method可以作用于对象并调用对象属性进行运算。
最终形成:
能力决定能够完成什么\boxed{ 能力决定能够完成什么 } 决策决定选择什么\boxed{ 决策决定选择什么 } 高层Method决定如何组织解决问题\boxed{ 高层Method决定如何组织解决问题 } 类Method决定如何处理具体对象\boxed{ 类Method决定如何处理具体对象 } Operation执行具体运算\boxed{ Operation执行具体运算 } Action产生实际行为\boxed{ Action产生实际行为 }
最终形成WSaiOS-SI中从知识到行动的完整结构:
Knowledge→Cognition→Capability→Decision→ProblemSolvingMethod→ClassMethod→Operation→Action→Feedback→ReCognition\boxed{ Knowledge \rightarrow Cognition \rightarrow Capability \rightarrow Decision \rightarrow ProblemSolvingMethod \rightarrow ClassMethod \rightarrow Operation \rightarrow Action \rightarrow Feedback \rightarrow ReCognition }
由此,Method不再只是传统面向对象编程中的一个函数概念,而成为WSaiOS-SI从能力、决策到问题解决和实际行动之间的核心结构。