4 ms·
Imperative: modifying state is the point of a bit-flipping machine; get out of my way so I can have fun! OOP: OK, I mostly had enough fun, can we try to tame t
by kazinator 4y ago
Imperative: modifying state is the point of a bit-flipping machine; get out of my way so I can have fun!
OOP: OK, I mostly had enough fun, can we try to tame the bit-flipping chaos with real-world analogies, without deflating all the fun?
Functional: Any Monad is by definition an Endofunctor, which also means it's an object in the category of Endofunctors, where the monadic μ(flatMap) and η(unit) operators satisfy the definition of a Monoid in that particular Monoidal Category. You got that?
Declarative: I'm gonna need a corner office with a view, and $200K/y.
- noman-land 4y agoThis made me laugh. Especially because I've read that exact monad snippet before and had several wtf moments in rapid succession.
- bradrn 4y agoI feel I should point out that that ‘functional’ quote is (a) only applicable to pure, strongly-typed functional languages, and (b) pretty much irrelevant unless you happen to be interested in category theory.
- epwr 4y agoYou might want to look a bit more closely before you write functional programming off like this. Eg. Clojure is a modern functional language that is used for a lot of things & happens to be dynamic.
- bradrn 4y agoSince when was I writing off FP? My main language for personal projects is Haskell. I was just pointing out that the category theory stuff isn’t really relevant at all.
- fulafel 4y agoYep, the FP scene is split into the pragmatic and the academic sides. I think it is not precisely delineated along the static vs dynamic sides: In addition to Elixir/Erlang, and Clojure we have eg F# and Elm from the static side in the pragmatic team.
- bradrn 4y agoI think the distinction you’re trying to make is that of ‘impure’ vs ‘pure’; ‘pragmatic’ vs ‘academic’ strikes me as a rather loaded choice of terminology, especially since languages like Haskell are rather widely used practically.
- tasuki 4y agoI don't think that's the distinction fulafel tried to make. Elm is very much pure, yet it's on the pragmatic side: it forgoes certain powerful abstractions (higher kinded polymorphism, type classes), which enables the compiler to give very helpful error messages, and makes the language easier to learn.
- bradrn 4y ago> Elm is very much pure Huh… you’re quite right. I always thought it was impure. In that case I retract my previous comment (pity I can’t edit it any more!).
- irrational 4y agoIsn’t OOP a subset of imperative programming and functional a subset of declarative programming?
- EugeneOZ 4y agoYou can be very declarative with OOP.
- seanhunter 4y agoNot really. For example ocaml allows oop in a functional programming language. OOP is about encapsulation of data and algorithms which deal with that data in logical units (objects) and allowing certain operations eg inheritance, polymorphism (sometimes) etc over those objects. It can be declarative or imperative.
- dgb23 4y agoThere’s another variation to ‘functional’: Let’s treat data as what it is so I can sleep at night again.
- jraph 4y agoThis made me smile. I'm not sure I get the declarative one though, can someone expand on this? Is it because the sentence is very declarative? or because declarative programming allows lets to declare expensive to compute stuff (by mistake) too easily?
- cubefox 4y agoI think it's the first.
- overtomanu 4y agoYou don't tell the computer how to do the task, but you tell what result you want. Eg: SQL
- deafpolygon 4y agoFunctional languages is what happens when you let a bunch of mathematicians get a hold of a compiler. At it's core, it's about treating data like data and not about having to much about with "objects".
- ahartmetz 4y ago...and it's a real shame that Haskell has to be like that. I feel like much of the, sorry, mathematical wankery, is well separable from the stuff that actually makes program behavior more predictable in the functional style. I hear that F# has some success at doing exactly that.
- quchen 4y ago> mathematical wankery Some blog posts are wankery. Haskell in practice is as separate and separable from it as you want. I learned what a mathematical monad is out of interest (after using them in practice for years), and my conclusion is that it was a huge waste of time with close to zero use for my programming in Haskell.
- tome 4y ago> I learned what a mathematical monad is out of interest (after using them in practice for years) Agreed. I regret that I tried to learn what a mathematical monad was before using them, out of a belief that it would help me get started quicker with Haskell. It didn't. It made something confusing that's actually pretty simple.
- lysecret 4y agoCan confirm been working with F# for 2 months and I really miss the strong type system, DU and match statements when I go back to Python.
- azubinski 4y agoApplause!
- DonaldPShimoda 4y agoI wish people would quit propagating this hostile view of functional programmers. The vast majority of them — even in academia — are happy to never mention or even fully learn about the scary math words, and most of those who _do_ learn about them work really hard to not make the community unwelcoming to those who don't know or don't want to know. But the reputation precedes, which causes people to avoid it altogether, which is really a shame. The whole "a monad is a monoid in the category of endofunctors, what's the big deal?"-in-a-condescending-tone bit comes from "A Brief, Incomplete, and Mostly Wrong History of Programming Languages": a satirical blog post from 2009 (http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html http://james-iry.blogspot.com/2009/05/brief-incomplete-and-m...). It is not indicative of the general community, but the joke has been reproduced enough that people who don't know anything will encounter it, think the practitioners are serious about it, and write off the whole thing as unwelcoming. It's a bummer.
- hinkley 4y agoIt would help if functional didn’t collect all the people with their heads all the way up their own asses. Functional has more shibboleths than anybody except maybe professional consulting groups like IBM GS. You can’t have exclusive language and then be surprised when nobody wants to worship at the altar of your obfuscation. ETA: Look. I was reading 25 year old complaints about why Lisp isn’t popular 25 years ago. You can go on scratching your heads for another 25 years or you can start taking criticism instead of deflecting.
- DonaldPShimoda 4y ago> ETA: Look. I was reading 25 year old complaints about why Lisp isn’t popular 25 years ago. You can go on scratching your heads for another 25 years or you can start taking criticism instead of deflecting. Is this... directed at me? Are you saying that I've been guilty of this behavior? Could you point me to an example? Because I put a lot of effort into helping the functional programming community be more welcoming, so it'd be important to me to know if I've gone astray somewhere. > It would help if functional didn’t collect all the people with their heads all the way up their own asses. I don't disagree that the kind of people who like to be particularly condescending tend to also end up in this community. That said, I will point out: (a) there are still plenty of assholes in non-functional (or even anti-functional) communities, and (b) the community has grown a lot over the years, and has mostly shifted to being much more positive and inclusive. Unfortunately, the reputation from decades ago is still strong, and I honestly believe part of that is due to historically-justified propagation from people like you in this comment and the other person in the comment to which I originally replied, to name two examples. There's a lot of residual hostility against the FP community that I don't think is truthfully justifiable anymore.
- rshaban 4y agothis one made me laugh!! thank you :)