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.

Don’t Be Scared Of Functional Programming

53 pointsby subbzalmost 11 years ago

11 comments

cessoralmost 11 years ago
I am not so much scared by functional programming as I am annoyed by functional programmers. I feel that they often come over like mathematics professors that just fill the chalkboard with lightning speed and look at you like &quot;seriously, how dare you ask this dumb question&quot;. They go ahead explaining to you how your language is crap for all its sideeffects, smugly explaining how their language doesn&#x27;t have those and then explain to you how Simon Peyton Jones shoehorned them into haskell with a monad. Also you always appear to fail to understand monads and they always fail to explain in an understandable way (although they&#x27;re not that hard to get).<p>Functional programming is great and feels right, I am amazed how knowledge of fp affects my js, C# and Python up to this day. But from a social perspective: Loose the smugness, and then we&#x27;ll talk fp.
评论 #7978421 未加载
评论 #7978540 未加载
评论 #7978591 未加载
评论 #7978857 未加载
评论 #7978622 未加载
slaprestaalmost 11 years ago
Smashing Magazine on functional programming, getting most of it wrong. This is the very moment functional programming jumps the shark.<p>It&#x27;s too mainstream for me now, I&#x27;ll have to switch to reactive programming.
评论 #7977632 未加载
评论 #7977792 未加载
评论 #7977578 未加载
grayrestalmost 11 years ago
If you&#x27;re interested in FP in javascript, you should check out the relatively new Ramda.js [1]. It switches from the underscore style collection first call pattern to a collection last pattern and automatically curries its functions. The combination allows for easier function composition.<p>[1] <a href="https://github.com/CrossEye/ramda" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CrossEye&#x2F;ramda</a><p>More info on the topic:<p><a href="http://fr.umio.us/why-ramda/" rel="nofollow">http:&#x2F;&#x2F;fr.umio.us&#x2F;why-ramda&#x2F;</a><p><a href="http://www.youtube.com/watch?v=m3svKOdZijA" rel="nofollow">http:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=m3svKOdZijA</a><p><a href="https://speakerdeck.com/raganwald/javascript-combinators" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;raganwald&#x2F;javascript-combinators</a>
评论 #7978461 未加载
droithommealmost 11 years ago
&quot;Don&#x27;t be scared&quot; rhetoric is generally used to promote arguments not primarily through logic, but by painting the audience as fearful luddites, scared of progress and the inevitable better future based on whatever the speaker is advocating. The goal is to encourage the listener to convert to the new religion or paradigm, or be considered backwards, behind the times, and ignorant or stubborn. It&#x27;s an effective tactic because any push-back is pre-framed as evidence the listener is among the ignorant backwards people.
评论 #7978076 未加载
评论 #7977806 未加载
评论 #7977538 未加载
评论 #7977993 未加载
评论 #7977976 未加载
评论 #7977971 未加载
chris_mahanalmost 11 years ago
I&#x27;m not scared. It just does not make sense to me.<p>Just because I speak French and English fluently does not mean I can speak Japanese. My wife is Japanese, and speaks it fluently. We&#x27;ve been together 19 years. I&#x27;ve tried to learn. it just does not make sense. It would be nice, because I have relatives there, and I could go live there, legally, but it just doesn&#x27;t make sense in my brain.<p>What can I do?<p>Functional programming is the same. Every couple of years I take a look, and I recoil in confusion.<p>It also doesn&#x27;t help that people make fun of me for seeming dumb.
评论 #7978619 未加载
评论 #7978617 未加载
评论 #7978522 未加载
评论 #7978566 未加载
valarauca1almost 11 years ago
Maybe its me being thick, but I can&#x27;t honestly wrap my head around what the fundamental good thing in functional programming is. When ever I work in a functional language I just find myself missing objects.<p>OOP just feel more eloquent to look at personally.<p><pre><code> Struct.function(arg1, arg2, arg3); </code></pre> feels more atheistically pleasing to my mental model of programming then<p><pre><code> function(struct, arg1, arg2, arg3); </code></pre> This means more complex function definitions. While I can define multiple .close(); functions, that only operate in relation to their connection type I.E.: tcpConnection, serialConnection can each call their own close(). In FP I have to actually state either:<p><pre><code> fn close&lt;T&gt;(&amp;:&lt;T&gt;){ if(&lt;T&gt;::isType(tcpConnection)){ tcpConnectionClose(&lt;T&gt;); }else if(&lt;T&gt;::isType(serialConnection)){ serialConnectionClose(&lt;T&gt;); }else{ &#x2F;&#x2F;throw exception } } </code></pre> Or I just make primitive calls to each connection type<p><pre><code> tcpConnectionClose(*); </code></pre> This just doesn&#x27;t stroke me the right way. It feels like bulky, over necessary coding when you take into account objects exist. I&#x27;m interested in FP, I feel it has to offer something for people to jump on it, but I just don&#x27;t get it.
评论 #7979849 未加载
评论 #7979729 未加载
评论 #7980375 未加载
badman_tingalmost 11 years ago
&quot;Functional programming is the mustachioed hipster of programming paradigms.&quot;<p>Well, <i>that&#x27;s</i> not helping. But I agree that devs should learn FP, and I now write in a much more functional style than I used to. I resisted for a long time, and that was a mistake.
peatonalmost 11 years ago
&gt; The literature relies on somewhat foreboding statements like “functions as first-class objects,” and “eliminating side effects.<p>I personally find this view a little overbearing.<p>In &quot;lay programmer&#x27;s&quot; terms, functions as first-class objects can often come down to being able to pass functions to other functions or function composition. Most of us learned about function composition in Algebra 2... So that&#x27;s pretty straightforward even at its worst.<p>Eliminating side effects is equally straightforward in that all it means is that any variables outside the scope of a given function are not changed by the function.
评论 #7978147 未加载
评论 #7978334 未加载
yxhuvudalmost 11 years ago
To be honest, this looks more like an explanation of the concept of abstraction than of the concept of functional programming.
doctorKriegeralmost 11 years ago
one of the points of the article is wrong, fp isn&#x27;t stateless at all it just tends to represent state in a different way - look at monads in haskell.
评论 #7977969 未加载
评论 #7978426 未加载
innguestalmost 11 years ago
If you&#x27;re interested in learning FP but struggling and would like to beta test didactic material for beginners, I urge you to get in touch with me. I&#x27;m making a series of videos explaining the concepts and abstractions of functional programming in a socratic way and from scratch (so not assuming even that numbers exist). I&#x27;m &#x27;uploaded&#x27; at google&#x27;s email service.