We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(10)
我认为这不会教给你太多。 在不同编程范式之间的差异真正显现出来之前,程序必须具有一定的大小。 如果同一个程序用不同的语言,人们不太可能编写相同的副本,除非该程序很简单。
大多数现实生活中的示例也会受到大量额外噪音的污染,这些事情可以在一种语言的标准库中完成,但需要另一种语言的第三方库。 编写它的程序员可能比另一种语言更熟悉一种语言,因此他在某些语言中的实现并不代表它“应该”如何完成。
您更有可能以通常的方式了解这些范例之间的区别。 通过学习每种含义以及如何使用它。
I don't think this is likely to teach you much. The program has to have a certain size before the differences between different programming paradigms really show. And people aren't likely to write identical copies if the same program in different languages unless the program is trivial.
Most real-life examples would also be polluted with a lot of extra noise, things that can be done within the standard library of one language, but requires third-party libraries in another. And the programmer who wrote it may be more familiar with one language than another, so his implementation in some languages isn't representative of how it "should" be done.
You're more likely to learn the difference between these paradigms the usual way. By learning what each means, and how to use it.
我推荐99瓶啤酒网站
I recommend the 99 bottles of beer website
您可以随时查看Project Euler。 人们用多种不同的语言解决相同的问题。 大多数人都会发布他们的解决方案,您在解决问题后也可以访问这些解决方案。
You can always look at Project Euler. People solves the same problems in a many different languages. Most people will post their solutions that you can access after you solve the problem also.
看看计算机语言基准测试游戏。 它几乎以您能想象到的所有语言实现了各种程序。
Take a look at The Computer Language Benchmarks Game. It's got implementations of various programs in just about every language you could imagine.
对于您的目的来说,这可能有点简单,但是 Hello World Collection 始终是浏览起来很有趣。
This might be a bit simple for your purposes but the Hello World Collection is always fun to look through.
Rosetta Code 拥有大量数据,但与过程/面向对象区别相关的数据很少。 您还应该查看他们的相关网站的集合。
Rosetta Code has a wealth of data but very little of it is related to the procedural/object-oriented distinction. You should also see their collection of related sites.
多种语言的 Black Scholes 有大量 Black-Scholes 公式的实现。
该公式在 Objective-C/iPhone、F#、Autoit、Fortress、Lua、APL、SAS、Mathcad、J、MEL、Postscript、VB.NET、Clean、Ruby、Lisp、Prolog、PL/SQL、LyME、ColdFusion 中实现、K、C#、HP48、Transact SQL、O'Caml、Rebol、Real Basic、Icon、Squeak、Haskell、JAVA、JavaScript、VBA、C++、Perl、Maple、Mathematica、Matlab、S-Plus、IDL、Pascal、Python 、Fortran、Scheme、PHP、GNU、gnuplot。
Black Scholes in multiple languages has plenty of implementations of the Black-Scholes formula.
The formula is implemented in Objective-C/iPhone, F#, Autoit, Fortress, Lua, APL, SAS, Mathcad, J, MEL, Postscript, VB.NET, Clean, Ruby, Lisp, Prolog, PL/SQL, LyME, ColdFusion, K, C#, HP48, Transact SQL, O'Caml, Rebol, Real Basic, Icon, Squeak, Haskell, JAVA , JavaScript, VBA, C++, Perl, Maple, Mathematica, Matlab, S-Plus, IDL, Pascal, Python, Fortran, Scheme, PHP, GNU, gnuplot.
前几天有人在 Reddit 上发布了 Evil Walrus / ReFactory:
http://www.refactory.org/
Somebody posted Evil Walrus / ReFactory on Reddit the other day:
http://www.refactory.org/
这里有两个实现 n-body 的程序
Java实现
C 实现
您发现它们之间有什么区别?
Here are two programs that implement n-body
Java implementation
C implementation
What differences do you find between them?
考虑蛇和梯子游戏的实现
在程序设计中,我们可能会编写一个函数,就像
在对象设计语言中一样,我们将创建一个
Square
实例的链接列表,以及一些Ladder
和Snake
分支到其他方块的实例。正如您所看到的,我们在对象中以及它们的组合方式(而不是在 switch case 语句中)实现游戏规则。 这样做的优点是,
这种灵活性使得 OO 如此强大。
Consider the implementation of a snakes and ladders games
In a procedural design we might write a function like
in an object design language we would create a linked list of
Square
instances, with someLadder
andSnake
instances that branch to other squares.as you can see, we implement the game rules in the objects as well as the way they are composed (rather than in a switch case statement). This has the advantage that
this flexibility is what makes OO so powerful.