10 ms·
Functional programming's smugness problem
- jejones3141 15y agoI suspect that OOP had a similar problem at one time.
- cobrausn 15y agoI'm not so sure. OOP entered the scene and became a dominant paradigm in a short amount of time - this doesn't happen without massive amounts of evangelization (from existing users) and marketing, neither of which can be particularly smug if they intend on being successful.
- jleader 15y agoI don't agree that "OOP entered the scene and became dominant in a short amount of time", though I guess it depends how you define "entered the scene" (Simula 67? Smalltalk 80? C++ in the mid 80s? Java in the mid 90s?) and "dominant" (presumably the rise of Java as a mainstream language in the late 90s?). Maybe if by OOP you just meant Java? Note that in the early days of OOP (pre-Java, say the first few years of OOPSLA in the mid to late 80s) there was a lot of overlap between the FP and OOP communities, both because CLOS was one of the pioneers exploring some of far corners of OOP, and because aficionados of weird languages tend to flock together.
- bunderbunder 15y agoWell, OOP had some help in the form of C++. It was easy to sneak in because it didn't strictly require people who were used to C to change their habits. Folks could, in effect, switch compilers first and then learn the language at their leisure. Of course, you could also make the argument (and I would) that C++ wasn't really an object-oriented language so much as a structured language with classes thrown in. Most of the popular functional languages, on the other hand, require folks to do a whole lot of mental gearshifting before they can be productive in the new language. That's a natural impediment to adoption. I suspect, though, that functional programming has finally found its C++, in the form of more recent versions of C#. Like with C++, it doesn't require users to immediately switch programming styles to be able to get the job done. Also like C++, though, you really can't use the language to its full capacity without getting very comfortable with a lot of functional programming concepts. Pretty much all of the neat new stuff in the .NET 4 class libraries, for example, is built around higher-order programming. Most of it will also be useless (or at least severely crippled) for someone who can't get past relying on mutable state.
- jgon 15y agoOOP was able to become dominant because it came with some clearly defined "killer apps", the likes of which I have yet to see materialize from the FP world. I mean, Smalltalk shows up in Byte and says "look, here is an entire system for graphically interacting with a computer, creating music, simulations, animations, drawing programs, documents, and more. It is so easy that school children can use it. We have managed to accomplish all of this in a few hundred thousand lines of our language called Smalltalk, which incidentally also contains the implementation of all the dev tools and the standard library. How large would this be in the language you are currently using (probably COBOL, Pascal, C or something similar)?" I get that FP has some very good characteristics, and I have tried to add a bit more "functional-ity" to my code over the years, but at the same time I get an overwhelming urge to say "put up or shut up" every time I am confronted with an article talking about how terrible OO and the programmers who work in it are, and how those working in FP are in some sort of enlightened programming utopia. Convince me by showing me some examples of programs so good that I can't possibly ignore them, the way OOP did. Convince me by becoming the foundation of almost every program I am currently running on my computer right now, the way OOP did. Don't convince me by writing article after article showing how insanely elegant your implementation of a mathematical function (My head will literally explode if I see another Fibonacci example) is, and how brain damaged what I am currently using must be. Numerical code comprises probably 0.1% of any computer system I am currently using. Show me instead how easy you just made to it interact with my computer, to write the type of programs that I am currently using and, for bonus points, to write the types of programs that I didn't even think were possible.
- KingMob 15y agoHmmm. The killer app, when it comes, will probably be for parallelism. Since FP languages are better able to control state, they can neatly sidestep many of the contention issues that plague imperative programming in multi-core scenarios. Problems that require heroic programming in imperative realms become much simpler in certain FP languages. And given that clock speed is settling down while core numbers are ramping up, I think this alone will make FP more compelling. It's more about appropriateness, though, than anything else. I still think OOP is great for things like GUIs, modeling complex domains. As always, the trick is to pick either the right language for your problem, or pick a multi-paradigm language, and choose the right approach for your problem.
- sp332 15y agoOOP's problem wasn't so much smugness as a messiah complex, or maybe cargo-cult application of OOP when it really wasn't a good fit for the problem.
- stcredzero 15y agoI suspect FP will have more resistance to cargo-cult application. I suspect far fewer people who have a partial understanding of FP will be able to hold a job doing FP than was the case for OOP. Heck, I know of one programmer who not only held an OOP programming job, but got to write a major subsystem -- with all long deeply nested class-side methods with 4 to 5 temp variables acting as merge-sort style incrementing indexes and not a single instance method or instance variable in sight. Last I heard, she was promoted and has great job security.
- AnthonBerg 15y agoSmugness is in the eye of the beholder.
- cobrausn 15y agoThat's just something smugly people say. ;-)
- joeyh 15y agoI have never, ever seen "Monads are just monoids in the category of endofunctors" used in an actual conversation with someone who is trying to learn monads. The phrase is and always has been a joke; surely part of the joke is that most of us who use monads don't understand all that jargon ourselves. http://stackoverflow.com/questions/3870088/a-monad-is-just-a-monoid-in-the-category-of-endofunctors-whats-the-problem http://stackoverflow.com/questions/3870088/a-monad-is-just-a... BTW, the article asks about design patterns that structure functional programs. Well, monads are one such pattern. That's why they're important, not some mathematical jargon.
- deleted 15y ago[deleted]
- Muzza 15y agoPlease read between the lines. The author wasn't implying that anyone actually said that, just like he doesn't think anyone has ever said this in real life: >"Design patterns? Hey everyone, look at the muggle try to get the wand to work!"
- technomancy 15y agoWell actually... https://mobile.twitter.com/bos31337/status/187564706255486978 https://mobile.twitter.com/bos31337/status/18756470625548697...
- ozataman 15y agoI can speak only for Haskell-land, but I honestly see no truth in any of the author's negative arguments towards the functional programming community. I have been doing most of my programming in Haskell for 3 years now, having worked in Ruby and Python before that. I can tell you that the Haskell community is among the most cordial, helpful and communicative I have ever seen in any field. In fact, many members of the community will cry foul if anyone dons on a "smug" attitude at any point; I've seen countless comments on reddit get buried for this alone. If you want proof, just ask a question on StackOverflow[1], join #haskell on freenode or check out the reddit[2] page. [1]: http://stackoverflow.com/questions/tagged/haskell http://stackoverflow.com/questions/tagged/haskell [2]: http://www.reddit.com/r/haskell/ http://www.reddit.com/r/haskell/
- CJefferson 15y agoI find that many functional programmers, including Haskell programmers, seem convinced that I will completely abandon C++ if only I spent the time to understand Haskell. After spending quite a bit of time learning Haskell, seeing a number of advantages and disadvantages, and being unconvinced and staying with C++, the assumption is I didn't "do enough". Of course, I also know a number of lovely functional programmers as well!
- mgkimsal 15y agoThis is almost the definition of religious differences. Adherents of religion X will tell you how it changed their life, and it can change yours too, if you just believe hard enough. When you investigate, find problems or just say "it's not for me", it's "your fault" for doing it wrong, or with a bad attitude, or you didn't talk to the right people, or you'll "grow up" later and 'see the light'.
- sold 15y agoI disagree - choosing a language is not choosing a placebo. Languages are tools, and need to be chosen appropriately. Often the exact choice will not matter (compare Java/C# or Python/Ruby), but sometimes it will. "it's not for me" is not a valid excuse, it means you cannot handle the tool. This is your fault. A valid excuse is "it's not for my application domain".
- canthonytucci 15y agoI dont think it gets much friendlier than Learn You a Haskell http://learnyouahaskell.com/ http://learnyouahaskell.com/
- grayed_comments 15y agoI totally agree with the author in my experiences. To be fair those individuals were also egotistic elitists in other realms of their life. "If there's anything around here more important than my ego, I want it caught and shot now!"
- fleitz 15y agoThe downside of being better than everyone else is psople tend to assume you're pretentious. I learned FP by doing it, not asking around what monads are. There are plenty of great tutorials and no one has ever seriously talked about monads in that way. The only time you really need to know what monads are is when you are building a new one.
- ajross 15y agoThe downside of being better than everyone else is psople tend to assume you're pretentious. The article used the word "smugness", not "pretention". They don't quite mean the same thing. Being merely better than someone might certainly seem pretentious depending on context. Telling everyone about it (in a context without relevance or evidence), however, is undeniably smug.
- VeejayRampay 15y agoI like how you respond to an article addressing smugness in FP by starting your post by "The downside of being better than everyone else is people tend to assume you're pretentious". I guess the OP doesn't even have to make his case when people like you serve such an unadulterated example of the very problem he was describing.
- ciderpunx 15y agoI've just started having a play with Haskell which I got interested in after working through the seven languages in seven weeks book. I've not really seen much smugness in the Haskell community. Though there are some proper clever people talking about stuff I don't understand, I don't feel they've done it in a patronizing way (or at least its been to subtle for me to pick up on!) That's my experience anyhow. I realize that the plural of anecdote is not data. I'm actually more interested in the second part of the article where the author talks about claims of productivity gains from functional programming being exaggerated. I am curious if folk on here can point to counterexamples to the study quoted. My strong suspicion is that there is much more likely to be a large variance in the productivity of programmers than in the productiveness of a particular language or way of programming.
- michaelochurch 15y agoOP strikes me as someone who is trying to position himself as a "moderate" but who is mistaking a caricaturized extreme (<0.25%) for "functional programmers". Honestly, I like FP extremists better than their OOP cargo-cult counterparts, who have the same smugness but are usually better, in most companies, at getting managerial blessing. In many companies, OOP acolytes glow in the managerial sun like Dudley Dursley, despite the general crappitude of their ideas. "Functional programming" in the real world isn't about dogmatically eliminating mutable state. It's about managing it. It's about modularity. It's not far from the original vision behind OOP-- before it got taken away by the wrong crowd-- which was that when complexity is inevitable, it should be encapsulated behind simpler interfaces. For example, SQL is append-only (as functional as one can get over a growing knowledge base) if you never use DELETE or UPDATE. The inner guts of SQL are not "purely functional"-- caching and indexing cause internal state changes, for performance reasons-- but the interface is. I don't even know what endofunctors are. If it's relevant to my job, I'll learn about them, but I care more about writing good software than reciting category-theory arcana. I'm sure it's important (especially as an inspiration for design) for some people, but you don't need to know them to do functional programming. Not even close. And I was already a productive functional programmer (in Ocaml and Lisp) before I even knew what monads were.
- demian 15y agoThat's the thing, FP is not only a great model for writing a CRUD or any kind data-processing system, but also things like Haskell's type system makes it incredibly powerfull to "hack away" code while controlling complexity. And both are things that FP extremists doesn't seem to like to promote. The "scientific" culture seems to revolve around using it for numerical computations, while trying to get as close as doing "formal proofs" as possible.
- moldbug 15y agoThe problem is that the best, most expressive functional languages (lookin at ya Haskell) are mathematically based on this theory. If you want to use these languages, you have a choice between (a) learning the theory, and (b) not fully understanding the tool you're using. Both have significant downsides from a UI perspective. Learn You A Haskell is a classic case of (b). As a tutorial it's completely successful, and how? It tells you that you can learn Haskell without learning PL theory. It also neglects to tell you how to debug you a Haskell (without learning PL theory). But once you type in the examples, I'm sure you can figure it out. A lot of people are smart enough to program on top of mysterious black boxes. That is: a lot of people are smart enough to work past this UI problem. Moreover, the smartest people can learn Haskell by rote and then gradually, through intuition and experience, learn to grok the black box. This is not to say, I think, that it's not a problem. Of course you could just learn the theory. I'd say anyone who can graduate with a math degree from an Ivy-class university can do it. Is you a member of this set? Find out by reading the Wikipedia page for Hindley-Milner: http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner I'm sure there are simpler explanations of H-M (Haskell's type inference algorithm). But they're not on Wikipedia. I sent this link to a friend of mine with a PhD in astrophysics from Caltech. "Which seems easier to you?" I asked. "This, or special relativity?" You can probably imagine his response. So, wanted: a higher-order typed functional language whose type system is easier to understand than special relativity. Or of course a proof that such a device is impossible :-)
- granitepail 15y agoThis article serves to fracture the community in a manner disturbingly similar to that in which the 'smug functional programmers' he complains about do. I can't help but sigh. I think the recent rise in popularity of functional programming is a sign that more people are beginning to approach computing from a 'computer science' perspective as opposed to a 'programming' one. That is, to say, that the industry has matured to a point in which a significant portion of industry programmers are getting excited about some of the more abstract concepts brought to us through functional programming. Few people will argue that the concepts underlying FP don't take some time to internalize, but the number and quality of FP learning resources is increasing at an incredible rate. This, alone, makes me skeptical of the author's points — people are going out of their way to create accessible learning resources so that they might share something they find to be useful/interesting. In any movement of any kind, there will always be evangelists. Some (read: most) of these evangelists will be overly aggressive and preachy, but they are rarely (read: never) representative of the larger body. In the past two years I've become quite a fan of Clojure, and I have found the community to be tight-knit, welcoming and eager to share.
- lincolnq 15y agoIs that why more people are learning FP? I think it's a different trend: recognition that programming is no longer about writing tight loops. Those have mostly been written. Instead, practical programming these days is dominated by orchestrating different people's code. Functional languages move more quickly here because functional code is, in some sense, more reusable by default.
- granitepail 15y agoI don't think our ideas are mutually exclusive — what you're describing is the notion of abstraction as it is applied to writing code. FP gives programmers incredible power with regards to reusing code (macros, first class functions, etc) at the expense of taking a little longer (in some cases) to wrap one's head around. I was merely commenting that I think part of the reason people have been drawn to FP lately is that the industry as a whole has matured to a point in which more people recognize the need for and have developed the skills necessary to embrace such abstractions.
- guccimane 15y agoOh, stop. I'm tired of hearing about "smug" being the worst thing ever. Too easy to toss this insult around. Instead, personally my issue with functional programming is the aversion to side effects. It seems to cause a lot of weird contortions, when the whole reason we make software in the first place is for the side effects. Programming in a functional style brings with it a lot of wonderful, powerful ideas. But that one has always struck me as unfortunate.
- fpgeek 15y agoI couldn't disagree more. I find that the aversion to side effects even when working in imperative languages is one of the most useful things I've learned from functional programming. It is true that, at one level of abstraction, we write programs for their side effects. However, it is also true that having the right side effects is extremely important - so important that a program with the wrong side effects can easily be worse than no program at all. From that perspective, a focus on minimizing, containing and controlling side effects is very valuable. And an aversion to side effects is a good way to sharpen your focus on that.
- guccimane 15y ago> I couldn't disagree more. I know. Trust me, I know.
- lucian1900 15y agoBanning side-effects like IO does create the need for odd contortions, but having less side-effects and little or no mutable data makes error recovery and debugging so much nicer.
- KingMob 15y agoWhile it's true that the output/observable behavior is what we want out of a program, whether the internals rely on side effects, strictly speaking, isn't relevant to producing useful things for the users. I won't deny that sometimes, a lack of side effects results in weird contortions, but there are ways around it and benefits that make up for it. Since side-effect-free functions are way easier to predict, debugging time is much shorter in FP, I find. Monads, while difficult to grok at first, are elegant ways to get around side effects in pure FP languages. Or, just go with my personal favorite solution, use an FP language that's not pure (e.g., most Lisps). They tend to encourage side-effect-free and/or state-free programs, but do not strictly require it. This gives you the best of both (IMNSHO); 80-90% of your code is side-effect-free and easier to debug, and the side-effect code is relatively contained and straightforward (in an imperative sense).
- m0th87 15y agoMy experience is the exact opposite. Whenever I struggle with an FP concept, those deeply nested in the community tend to be both eager to help and pretty unassuming. This is especially true among Haskellites (Haskellistas?) who usually understand there's a high learning curve associated with the language.
- technomancy 15y agoHis examples come from the Scala community; I wonder if it's more pronounced there? I get the impression Haskell folks are fairly laid-back too.
- xd 15y agoOut of curiosity .. when was the last time you read a story that told of company x dominating the market because they used programming paradigm n.. just a thought.
- lincolnq 15y agoViaweb?
- xd 15y agoThe wikipedia entry states viaweb was partially written in lisp .. would be interesting to know what part lisp played .. is pg in the house?
- dpritchett 15y agoThis nine year old essay by pg is very well known: http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html Our hypothesis was that if we wrote our software in Lisp, we'd be able to get features done faster than our competitors, and also to do things in our software that they couldn't do. And because Lisp was so high-level, we wouldn't need a big development team, so our costs would be lower. If this were so, we could offer a better product for less money, and still make a profit. We would end up getting all the users, and our competitors would get none, and eventually go out of business. That was what we hoped would happen, anyway.
- andrewflnr 15y agoViaweb, in which PG et al take over the e-commerce market with the power of Lisp.
- deleted 15y ago[deleted]
- kaffiene 15y agoMy general characterisation of Hacker News is that it's peopled by programming language snobs. I believe that this flows from PG - I mean, characterising people who don't share your view's as "Blub programmers". Sheesh! So, it's no surprise to me seeing that most of the responses here oppose someone pointing out that language snobs are snobs. I'm in the unenviable position - for a HN reader - of liking Java a lot. And amazingly, I knew Lisp (and loved it), C, C++, Ada, Python etc... BEFORE I learned Java. I've learned Haskell, C#, Ruby since and I STILL like Java. I'm pretty sure that the standard HN groupthink would have to conclude that I'm some kind of moron or I have no experience with software engineering or I'm wrong in some weird undefinable way. While I can't comment on the weird bit, I certainly DO have a lot of software engineering experience. People use the tools that work for them, and this varies for different people and different tasks. The article is corrrect: there ARE a lot of FP snobs and HN is full of them. Look, if it works for you, all power to you - just stop treating people who like other solutions as misguided morons. You too PG!