声明式系统 VS 命令式系统

1. 命令式系统(Imperative System) 

Imperative systems outline a sequence of operations that expresses the control flow of a given program as it moves from one state to another. Imperative systems, on the other hand, require a large number of rules and transitions in order to fully handle the complex cases of the driving task. As a result, this paradigm is hard to scale to more complex driving situations.

e.g., State machines are an example of the imperative paradigm. Such systems exhaustively describe the list of all possible states as well as the transitions between them.

2. 声明式系统(Declarative System)

Declarative systems, on the other hand, are able to express the underlying logic without specifically describing the control flow. Due to their lack of strict system flow, declarative systems are more resistant to change since the system has fewer inter-dependencies, consequently making them harder to implement.

e.g., Declarative systems can represent the internal logic in the following two manners. (i) Expert systems obtain a decision through the evaluation of a world state over a set of rules and combine them through inferential processes to obtain a final behavioural decision. (ii) Optimization systems encapsulate driving behaviour as a set of mathematical variables which are optimized with respect to a notion of optimal behaviour.

References:

[1] 声明式(declarative)和命令式(imperative)编程 - 简书

[2]声明式(declarative) vs 命令式(imperative)_声明式和命令式_Haor.L的博客-CSDN博客

你可能感兴趣的:(Software,Engineering,软件工程,声明式,declarative,命令式,imperative)