TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

OOP vs. FP

33 pointsby horridoabout 8 years ago

5 comments

Pitarouabout 8 years ago
I don’t wholly disagree with the article, but I think it overstates its case. In particular:<p>&gt; Is there really so much difference between f(o), o.f(), and (f o)?<p>Yes, there is!<p>In the case of o.f(), o needs to know about f.<p>In the case of f(o), f needs to know about o.
评论 #14234853 未加载
评论 #14234263 未加载
评论 #14234672 未加载
评论 #14235606 未加载
serichsenabout 8 years ago
Valid points, but not _the_ point. There is a big difference between allowing and supporting something.<p>OO languages _support_ hidden inputs and outputs as well as programming by mutation. They _allow_ programming in a functional style, but you will have to be inventive for it.<p>FP languages _support_ immutable values, referential transparency and all that. They _allow_ programming by mutation and hidden inputs and outputs, but you will have to be (sometimes very) inventive for it.
评论 #14234913 未加载
评论 #14235077 未加载
shady-ladyabout 8 years ago
hmm, not so sure I agree to that extent.<p>[To me,]<p>FP is more about nobody owning the data. Everything operating on all the data. (Mostly) All data exposed and accessible.<p>OOP is about certain classes owning data and limiting exposure to that data.
评论 #14235003 未加载
noblethrasherabout 8 years ago
A closure is a poor man&#x27;s object, and an object is a poor man&#x27;s closure: <a href="http:&#x2F;&#x2F;people.csail.mit.edu&#x2F;gregs&#x2F;ll1-discuss-archive-html&#x2F;msg03277.html" rel="nofollow">http:&#x2F;&#x2F;people.csail.mit.edu&#x2F;gregs&#x2F;ll1-discuss-archive-html&#x2F;m...</a>
crimsonalucardabout 8 years ago
Is this guy talking about OO as described by smalltalk? Because he says that objects are bags of functions, not data, but in languages like java, c# and c++ objects are bags of both.
评论 #14234993 未加载
评论 #14235099 未加载
评论 #14235561 未加载