面向过程与函数式
"面向过程"核心是"过程"二字,"过程"指的是解决问题的步骤,即先干什么再干什么......,基于面向过程开发程序就好比在设计一条流水线,是一种机械式的思维方式,这正好契合计算机的运行原理:任何程序的执行最终都需要转换成cpu的指令流水按过程调度执行,即无论采用什么语言、无论依据何种编程范式设计出的程序,最终的执行都是过程式的。
1、优点
将复杂的问题流程化,进而简单化
2、缺点
程序的可扩展性极差,
3、应用场景
```python
面向流程的编程通常用于功能在实现后很少需要更改的场景。如果您只是编写一些简单的脚本来完成一些一次性任务,那么使用面向流程的实现是非常好的。但如果您正在处理的任务很复杂,需要不断迭代和维护,则面向对象是最方便的。
[En]
Process-oriented programming is generally used in scenarios where functions rarely need to be changed once implemented. If you just write some simple scripts to do some one-time tasks, it is great to use process-oriented implementation. But if the task you are dealing with is complex and requires constant iteration and maintenance, object-oriented is the most convenient.