如何选择要使用的编程范式?
SO中有很多关于选择编程语言的问题。对我来说,我认为,如果我能够决定要使用哪种范式/模型,那么选择就会变得更容易。
但是,我的问题是,何时选择命令式、面向对象、函数式、逻辑和/或混合范式/模型?
哪种范例适合哪种类型的项目?
There are many questions in SO about choosing a programming language. To me, I think, the choice becomes easier if I can decide which paradigm/model I am going to work with.
But, my question is, When to choose Imperative, OO, Functional, Logic and/or mixed paradigm/model?
What paradigm is good for which type of projects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题
您可以在多种编程方法之间进行选择,但您不知道为特定项目选择哪一种。
解决方案
确定您的主要目标并选择最适合您目标的工具。
如果您不知道自己的目标,请从三个问题开始,这将帮助您集中精力和方向:
讨论
这个问题可以稍微细化一下,因为您声明您想要一个项目的解决方案,但您没有指定该项目的目标。
例如:
基本原理
计算机编程中的术语有时非常具有误导性。例如,如果您向任何两个程序员询问 OO 与函数式的精确定义,您几乎肯定永远不会从他们那里得到相同的答案。
这本身就是编程和学习如何编程的重要一课。只见树木、见森林的能力,而不是过于迷恋方法或工具,以至于失去对潜在目标和动机(这些目标和动机会发生变化)的关注。
另请参见
有一篇文章更详细地介绍了 OOP 与函数式编程的行话。 (例如,参见 OOP 的无术语介绍)
简单解释 PHP OOP 与 Procedural?
PROBLEM
You have the choice between several programming methodologies, and you do not know which one to choose for a specific project.
SOLUTION
Determine your primary goals and pick whichever tool suits your goals most effectively.
If you do not know your goals, start with three questions that will help you focus your energies and direction:
DISCUSSION
The question could be refined a bit, because you state that you want a solution for a project, but you do not specify the goals of the project.
For example:
RATIONALE
The jargon in computer programming is sometimes very misleading. For example, if you were to ask any two programmers for the precise definition of OO versus Functional, you will almost certainly never get the same answer from both.
This in itself is an important lesson in programming and learning how to program. The ability to see the forest for the trees and not get so enamored of methodologies or tools so much that one loses focus of the underlying goals and motivations (which change).
SEE ALSO
There is a write-up going into more detail about the Jargon of OOP versus Functional programming. (See e.g., Jargon-free introduction to OOP)
simple explanation PHP OOP vs Procedural?