- 命令式,指示程序如何改变状态
imperative: in which the programmer instructs the machine how to change its state
- procedural which groups instructions into procedures
- object-oriented which groups instructions with the part of the state they operate on - 声明式:只说结果,不说过程
declarative: in which the programmer merely declares properties of the desired result, but not how to compute it
一、命令式
指示程序如何改变状态
1.过程式 (Procedural programming)
采取过程调用或函数调用的方式来进行流程控制,包括一系列运算步骤的过程(Procedures),例程(routines),子程序(subroutines), 方法(methods),或函数(functions)来控制。在程序执行的任何一个时间点,都可以调用某个特定的程序。任何一个特定的程序,也能被任意一个程序或是它自己本身调用。
2.面向对象(Object-oriented programming,OOP)
对象则指的是类(class)的实例。它将对象作为程序的基本单元,将程序和数据封装其中,以提高软件的重用性、灵活性和扩展性,对象里的程序可以访问及经常修改对象相关连的数据。
二、声明式
只说结果,不说过程
1.functional
in which the desired result is declared as the value of a series of function applications: OCaml, Haskell
2.logic
in which the desired result is declared as the answer to a question about a system of facts and rules: Prolog
3.mathematical
in which the desired result is declared as the solution of an optimization problem: . Wolfram Language, Matlab
3.reactive
in which the desired result is declared with data streams and the propagation of change: Verilog