TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why functional programming matters (1990) [pdf]

102 点作者 palerdot超过 5 年前

10 条评论

BoiledCabbage超过 5 年前
If anyone is looking for a really eye-opening video take a look at that this. &quot;Domain Modeling Made Functional&quot;<p>It&#x27;s applying Functional Programming to plain old Enterprise line of business apps in F#. The author argues why it&#x27;s so much simpler, and simply walks through an example with cases. It&#x27;s hard not to be persuaded. It leaves behind all of the lofty crazy maths you see in a lot of presentations of FP, and just shows how it&#x27;s a simpler technique to solve real world problems.<p>Domain Modeling Made Functional - <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Up7LcbGZFuo&amp;feature=youtu.be&amp;t=508" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Up7LcbGZFuo&amp;feature=youtu.be...</a> (Watch on 1.25x speed)<p>It&#x27;s really impressive, and also surprising why more people promoting FP don&#x27;t show it&#x27;s tangible benefits and simplicity vs. the theoretical&#x2F;abstract way it&#x27;s usually presented.<p>It&#x27;s also a great introduction to &#x27;Domain Driven Design&#x27; and data modeling regardless of the language you use.
评论 #21488188 未加载
评论 #21488271 未加载
评论 #21491584 未加载
martin1975超过 5 年前
On one end we have FP, which is great for expressiveness and its declarative nature of getting things done, side-effect free, with nearly perl like terseness :)... but on the opposite end you have von Neumann CPU architectures which know nothing about FP. The utopian &quot;silver bullet&quot; is always something in the middle of course, a language that can give you the power and expressiveness of FP without sacrificing all the things that FP style compels you to bear - like mutability, performance optimizations&#x2F;fine tuning, etc.<p>Personally, I find languages like Scala to be right there in the middle, where neither performance nor FP expressiveness is sacrificed severely.<p>That makes Scala flippin complex like C++ was, but it is probably the best attempt to bridge this gap if we all just want to learn &quot;one language to rule them all&quot; and incorporates both FP and imnperative&#x2F;mutable style techniques that milk the hardware for what it&#x27;s worth as well as give you the power&#x2F;expressiveness of FP.<p>Of course one can write an operating system in Haskell... just as one can imitate functional style programming in C... or we can come up w&#x2F;some &quot;middle ground&quot; language that takes the cake from both worlds and call that &quot;the best&quot;.<p>My point is, this quest or journey for the best language&#x2F;paradigm never ends and always shifts across the years as hardware develops and as we discover better ways of doing more with less (e.g. the crux of FP).<p>IMHO, ultimately you have to pick an appropriate language (tool) for the job at hand. If we forget that languages&#x2F;programming paradigms are just tools... then, you&#x27;ll forgive me for saying, we become tools ourselves. Or... fools, rather.<p>To me, whomever has realized this trade-off, is a true zen master of programming&#x2F;engineering...not the one who espouses one paradigm&#x2F;language over another. That&#x27;s just me tho... YMMV.
评论 #21487822 未加载
brudgers超过 5 年前
Some previous discussions<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14138196" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14138196</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13129540" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13129540</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9502049" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9502049</a>
mpweiher超过 5 年前
This is an odd article, brilliant in parts, somewhat less so elsewhere.<p>The analysis of why we need modularity and that this means we need new kinds (plural) of &quot;glue&quot; is spot on. Note the plural. But then he goes on to present exactly two kinds of glue, so the smallest N for which the plural is justifiable.<p>I contend that he was richt that we need a lots of different kinds of glue, which means that the glue must be user-definable. And what is &quot;glue&quot;? Well, architectural connectors, that&#x27;s what.<p><i>Why Architecture Oriented Programming Matters</i> <a href="https:&#x2F;&#x2F;blog.metaobject.com&#x2F;2019&#x2F;02&#x2F;why-architecture-oriented-programming.html" rel="nofollow">https:&#x2F;&#x2F;blog.metaobject.com&#x2F;2019&#x2F;02&#x2F;why-architecture-oriente...</a>
h91wka超过 5 年前
Purely functional algorithms and data structures are typically slower. Imperative code is also more concise than equivalent functional code.<p>The only real benefit of functional programming is that it makes code much easier to reason about. But this difference is so great, that in most cases I am ready to pay the price.<p>P.S. Just to clarify my position to the commenters who want to convert me: I write code in functional languages most of the time for the living, so I know well enough how ST monad works, about &quot;O(log n) == O(1)&quot; meme, and so on. But I also have some background in HPC, where I used imperative languages. So I have plenty of experience in both paradigms, and I know exactly what are their weak and strong parts.
评论 #21487215 未加载
评论 #21487433 未加载
评论 #21489684 未加载
评论 #21487176 未加载
评论 #21487454 未加载
AlexanderDhoore超过 5 年前
For me (and I&#x27;m going to sound like a massive fan boy here) Rust has surpassed functional programming. It gives me mutable data when needed and immutable when shared. So ONLY having immutable data structures now seems stupid. We can have best of both worlds.<p>Read this if you don&#x27;t follow: &quot;In Rust, ordinary vectors are values&quot; <a href="http:&#x2F;&#x2F;smallcultfollowing.com&#x2F;babysteps&#x2F;blog&#x2F;2018&#x2F;02&#x2F;01&#x2F;in-rust-ordinary-vectors-are-values&#x2F;" rel="nofollow">http:&#x2F;&#x2F;smallcultfollowing.com&#x2F;babysteps&#x2F;blog&#x2F;2018&#x2F;02&#x2F;01&#x2F;in-r...</a>
评论 #21487464 未加载
评论 #21486955 未加载
评论 #21490197 未加载
评论 #21486816 未加载
gambler超过 5 年前
Rant ahead.<p>Functional programming discussions on HN are pretty depressing. Many of the statements about FP that I see here right now are the same old shit I&#x27;ve heard about Java in mid 00s. You just need to mentally translate some buzzwords, but the essence is the same. Seems like the software industry is just running in circles. Something get hyped, people jump on it, fail, then search for the next bandwagon.<p>Some examples:<p>1. Endless yammering about low-level correctness. As if it&#x27;s biggest problem in software engineering right now. In reality, most domains don&#x27;t need perfection. They just need a reasonably low defect rate, which is not that hard to achieve if you know what you&#x27;re doing.<p>2. Spewing of buzzwords, incomprehensible tirades about design patterns. FP people don&#x27;t use the term &quot;design pattern&quot; often, but that&#x27;s what most monadic stuff really is. Much of it is rather trivial stuff once you cut through the terminology. (Contrast this with talks by someone like Rich Hickey, who manages to communicate complex and broad concepts with no jargon.)<p>3. People who talk about &quot;maintainability&quot; of things while clearly never having to maintain a large body of someone else&#x27;s code.<p>Etc.<p>---<p>The #1 problem in software right now is not correctness or modularity or some other programming buzzword. It&#x27;s the insane, ever-growing level of complexity and the resulting lack of human agency affecting both IT professionals and users.
评论 #21488444 未加载
评论 #21487704 未加载
评论 #21488779 未加载
评论 #21487713 未加载
评论 #21487568 未加载
评论 #21489122 未加载
评论 #21488549 未加载
评论 #21488433 未加载
评论 #21491950 未加载
iflywithbook超过 5 年前
One of my favorite papers. Incidentally, although I&#x27;d spent my entire career chasing some elusive notion of &quot;good design&quot;, this paper was the first I have seen to explicitly define &quot;good design&quot; as &quot;modular&quot;.<p>It is now generally accepted that modular design is the key to successful programming... However, there is a very important point that is often missed. When writing a modular program to solve a problem, one first divides the problem into subproblems, then solves the subproblems, and finally combines the solutions. The ways in which one can divide up the original problem depend directly on the ways in which one can glue solutions together. Therefore, to increase one’s ability to modularize a problem conceptually, one must provide new kinds of glue in the programming language. Complicated scope rules and provision for separate compilation help only with clerical details — they can never make a great contribution to modularization<p>I now tend to see all the other design principles as ways to improve modularity. Everything else is mostly just fluff.
fwguru超过 5 年前
I think functional programming is an useful (and probably fun for some people) exercise to see how far you can go when solving problems with a limited or &quot;pure&quot; set of tools. We got and are steel getting a lot of insight from it. Like forcing a boxer to only box with one hand while the other one is tied behind his back. I&#x27;m sure one would have learn quite a few new tricks not to get battered in the ring that way. Things do get weird when people start forgetting the the world is a bigger place and there are a lot of ways do the same thing and the reality doesn&#x27;t care about purity. That makes some people bitter and they dig down even harder into their limited world and start evangelizing it even harder to signal their smartness. In their bitterness and anger they do not see that functional programming has made it big time. Almost every important language today supports multiple paradigms, including functional.
bitL超过 5 年前
If it mattered we wouldn&#x27;t have needed articles like this. It&#x27;s a useful niche for certain tasks, that&#x27;s about it. Certain types of people with certain thinking patterns strongly prefer it, other people don&#x27;t. :shrug:
评论 #21487590 未加载