If functional programming is so good, then why isn't all software written with it?

If functional programming is so good, then why isn't all software written with it?

Attached: FP-vs-OOP.png (735x414, 59K)

Other urls found in this thread:

paulgraham.com/avg.html
twitter.com/SFWRedditVideos

because it's not good
it's an academia meme

More and more stuff is slowly gravitating towards FP. It's just people being brainlets in general and not seeing the advantages yet.

Functional programming is available in modern procedural languages.

Why throw away the useful things.

because most if not all enterprise software hopped on the OO bandwagon in the mid to early 90's, and everyone just hiveminded the OO paradigm

this. if you want real world FP, erlang is your best bet

t. erlang dev

>it's an academia meme

Says every brainlet that can't into academic stuff.

Mathlets

1) Inertia wins out because functional programming is not a good enough improvement to justify suddenly shifting the whole industry

See Paul Graham for an example of the power of functional programming in a case where industry inertia was irrelevant (because he was building a small lean company from scratch in a newly emerging area): paulgraham.com/avg.html

2) It's probably harder to teach functional programming, with its greater abstraction, to armies of pajeets

3) I think managers in the software giants like object oriented programming because it generates lots of class diagrams, boilerplate, and other busywork to show off at progress meetings and divides a project into small chunks of work suitable to hand to a workforce of seasonal pajeets who won't have time to learn anything more about the code base than "here are some interface requirements, implement these three classes"

???
>If impact drills are so good, why aren't all construction projects using them?

It's like asking "If math is so great, why don't we write all our books with it?"

>Why throw away the useful things
Agreed.

Software isn't about "best paradigm", but about using the right tools to solve a given problem. Most real-world softwares are multi-paradigm.

OO is niggerlicious

Not user, but I'm interested in learning Erlang. Currently reading about Elixir and BEAM. Pretty great language IMO, but am afraid of the shortage of job options. How are you handling this?

FPBP

kek. so it's the pajeets' fault.

idk what functional programming language everybody else learns in college. we had a course using ML.

>Why do people use the easier thing
It's the same reason for C's success vs Pascal. You didn't need to have mathematical acumen to build things with it.

Schools teach Java so they can get jobs where corporations use Java.

Where do you see the opportunity to use functional languages unless you're high up to decide to or learn the language yourself?

To many desperate lazy people.

>mathematical acumen
implying functional programming does? i don't think math "acumen" in programming is measured by your expertise in a certain language. .

Yup. It's quarterly salary costs against code quality. Or did you think that American software companies are scrambling for h1b visas because pajeets are programming geniuses who learn all the most powerful tools at the University of New Delhi? :P

At least for what I do, functional programming would be great! Far more straightforward!
Unfortunately immutable data makes it insanely less efficient. I ain't gon be constantly copying massive fucking arrays everywhere.

Engineers are mathlets and are attracted to OO, since it is engineering-like in its methodologies and jargons. FP is math-like, it probably gives engineers PTSDs of barely passing calculus.

Why not both?

Just do it like Rust does, it uses best parts of both methodologies.(trait fields would be nice though)

Attached: both.jpg (600x600, 33K)

Because that's cultural Marxism. Can't let the commies win.

in practice, procedural languages beat both

get gud

OO is easier to write and tends to perform better.

Because different software come from different places and need to satisfy different needs
The algo that would solve prime factorization in p time would probably be written in a functional lang
But the people that will use it to crack everything on the internet will probably have C doing the workload and python or something fetching and feeding it data

One good reason is that you lose a large part of the benefits of FP if you start mixing in other practices.
That said, you could always limit yourself to the functional aspects of other languages.

Any good book on erlang?

Except OO and Functional aren't complementing paradigms
It's OO vs Monolithic and Functional vs Imperative
You can have an OO based architecture with purely functional components

Attached: 1543462862878.jpg (362x346, 38K)

You cannot have FP without GC apparently, so there are certain areas where you cannot even use FP.

>If having high IQ is good, then why do most people have low IQ like me?

>rust, a language with extensive use of FP, doesnt have a GC
>C++ and c generally do

what did user meant with this?

>functional programming
Algol?

Procedural is easier to write and tends to perform better

functards btfo

Attached: Screenshot_20190520_020011.png (991x653, 310K)

Because functional requires a White man's brain. Poos can't into functional.

the actual definition of OO isn't what people think of
they imagine giant abstract class hierarchies mapped to business structure
not independent actors passing messages

>functional programming
Algol suppost to be a revolution
but but C actualy was

C won because commercial computers were too shit for anything else

(((LISP))) makes me think of something bad.

C won because good for computers
"anything else"=f-cking bran to student for make em slaves useless for actual buisness

I was at a company that tried out functional programming for a project. The systems they set up were made up of small functions which were easy to compose, so they were extremely easy to test, allowed for rapid development, and allowed making changes easily.

Two main things killed it. The first was incompetent programmers unable to work with it. Despite the good programmers working measurably 10x faster than the whole team before and the project literally having no reported bugs in its lifetime, the company simply couldn't accept that they needed to fire or reassign such a huge number of employees. The second was incompetent management not being able to understand working on working on small functional programs that respond to change instead of "working on pages in the application", ie copy pasting code from the last page and never generalizing anything.

No it was because general computers were too shit to handle garbage collected languages at the time. Once computers got better, managed languages like Java replaced C in most domains where performance and bit-twiddling was unnecessary.

both are memes but at least you can get a job writing OO code.

Oo
>everything you do is a mess. "I'll clean this up later uwu"
Functional
>I have a fucking brain and a plan let's go baby!

This, sadly the industry is filled with H1b slaves so it's much cheaper to just brute force software development.

C won because AT&T wasn't allowed to sell Unix

I have never written a single line of FP in my life but from what I understand it is a monumental undertaking to write GUI's with it. If I had to guess I would say it doesn't work with even driven programming.

>one tool is best for any and all tasks
no user, thats not how shit works.

We're not in China, user, you don't need to flip your post upside down to compensate.

GUIs are one of the areas where OOP actually works really well.

>See Paul Graham for an example of the power of functional programming

Fucking LISP is not 'functional programming' you Haskell sucking fags. It's basically a "you do whatever the hell you want and the kitchen sink" imperative workhorse of weaponized autism. That it provides fantastic support for first class functions/closures is great, but don't pretend this has anything to do with your fantasies of 'purity' and how they would revolutionist the industry.

Use the best tool for the job. There is no tool best for all jobs. Personally, I prefer procedural code with functional and OOP aspects, where needed. Best of all 3 worlds.

Absence of misfeatures is a feature.

Is shit performance a feature?

Benchmarks put Haskell - the FP lang with the most wasteful features like laziness - on par with Java and other mainstream OOP langs. The only paradigm FP compares poorly against is data-oriented procedural.

>on par with garbage
How fitting.

>Java
>Slower than nu-C#
>Insanely slower than C/C++/Rust
>Hell probably even slower than fucking Go

Great comparision

The only sane answer in this thread.
If you know your shit, you can pick the right tools. If you need to ask what's better, you suck at development.

because most software are written by retards and programming languages are made to cater to their intellect.

What practical benefits do you lose?
I'm not asking about things like provability or other autistic things. Lifetimes and ownership rules already proves Rust code to be free from hazards and invalid references.
Doing io in pure functional language is the real hassle too.

For uni we had to write a little game in haskell. We basically had one file which waa pretty readable (at the time lol). If we were to do it in cpp, we'd have like 10 files or so. The performance wasn't that bad tho. You just need to be careful. Too bad they barely provide some sort of IDE with proper debugging capabilities and error reporting (oh god the errors). Other than that it's not bad.

Java competes with C# and Go but not C/C++/Rust. Apart from what you got wrong, you simply repeated what I said.

You said

>on par with Java and other mainstream OOP langs

When this is wrong as Java is slower than C#

>Oh no I have to add two characters to my function signature if I want to do IO.
Get real.

Java and C# are on par with one another in benchmarks of idiomatic code. The only time C# ekes out ahead is when you stop treating it as an OOP language and start using it as a procedural one with structs and unsafe pointers.

Not sure what you are talking about. I've only wrote few programs in Haskell, lisp and oz. I've never really done much pure functional programming and that's why I'm asking about details.

You said
>Doing IO in a pure functional language is the real hassle too.
But it really isn't. You just return an IO Foo instead of a Foo.

Yep, unironically 'Programming Erlang'. It is from the founder of the language.

some languages (Java) force OOP onto you and you don't get a choice

Why not use both?

You can do functional programming in Java.

Hardly. There's more to FP than lambdas.

Why not both ?

t. webdev

FP has a barrier to entry that keeps the average pajeet out.

FP sucks, certain concepts from FP are good and have been adopted by imperative languages, but actual FP languages are only used in academia where you can spend six weeks pondering why your 8 line program runs 168 times slower than the equivalent 30 line imperative version.

If you need to change programming language to structure your software, you are either one of the worst programmers out there or the structure is pretty bad.

>OO
>polymorphism
>abstraction

Attached: 1557985424790.png (350x394, 185K)

because the design of hardware is not based on lamda calculus
functional programming is more than just an abstraction strategy

This. Scrapping all the status quo to start over with functional is too much work and doesn't yield high enough obvious benefits

You can mix it.
OO for domain specific, typed processing
FP as async, parallel dispatcher

Good luck convincing FP autists to use a language that also supports OOP.

OOP happens to be a happy freak acident in how good it is at GUIs. FP is catching up tho with stuff like reactive programming. Flutter is actuay heavily influenced by that paradigm. (Simple version: there is a change world - change representation loop and the later is pure, basically there are no global variables you could use and share)

>on par with Java
try C++ dumbass

>if being overweight is unhealthy, why are there fat people?

So all the reasons why you would choose c++ over c#

It's gonna become a non-meme once multithreading and security becomes paramount in code design, which will happen in a few years since we're hitting the limits of what silicon chips can do. Assuming of course that undergrad programs start teaching functional, students can wrap their heads around it, and industry can adopt a new paradigm instead of holding onto convention out of a sense of comfort/tradition, all of which are pretty lofty assumptions

And Java lambdas don't even support proper closures.

>we're hitting the limits of what silicon chips can do
Great reason to write highly abstract slow FP code.

>See Paul Graham for an example of the power of functional programming
Everyone in this industry believes their own bullshit. The two biggest steaming piles of bullshit are:
* We're novel.
* Our tools are the mostest productive tools EVAH and we couldn't have succeeded had we used anything else.

Everyone had rushed into e-commerce by 1995. They may have been one of the first to put a normie store builder on their tool, but that had nothing to do with Lisp and everything to do with lucky timing.

Programmers fixate on languages the way amateur photographers fixate on equipment. For some reason we want to believe our tools make us special. The reality is that a few languages are more difficult to learn and more difficult to work in without committing certain mistakes. I would give C as an example. But an expert C programmer with a modern editor and set of libraries can be as productive, if not more so, than someone in a higher level language. It's not the tool, it's the engineer using said tool.

Now I have my favorite languages for different tasks like everyone else. But I also recognize that familiarity and library support are the dominating factors in my personal productivity. Typically not the language features or syntax itself. The mythical super language that's going to help brainlets "learn to code" and bang out thousands of bug free loc every day to be the fastest startup company evah doesn't exist and isn't going to exist.

>2) It's probably harder to teach functional programming, with its greater abstraction, to armies of pajeets
It literally exists to try and solve a class of problems that are really only problems for brainlet pajeets. And at the expense of CPU cycles and memory because the user can always buy more, amirite?

>Java competes with C# and Go
No, it literally does not. You implement the same exact algorithm in Java and C# and C# will smoke Java.

I know "Java is just as fast" is a meme and there are even some tests published online that would seem to support it, but I've never seen Java run as fast in the real world. This is backed up by every user who has ever asked "why does this Java app run like shit?"

Nigga wat?

I took a programming interview test in Java today and think I might have fucked up. The input was lists of data as strings, so I created a private nested class to represent them. It parsed the line in the constructor and had compareTo() and toString() methods, but for getting and setting I just used the field like a Struct.

Now I'm worried the recruiters are gonna expect me to code like some sophomore CS student and have 8 useless get/set methods or something. I didn't see the point. It's basically a glorified string that's easier to read, sort, and print. C didn't need encapsulated fucking structs.

Attached: redpanda.jpg (793x594, 116K)

Nice strawman argument, goy

because it's hard to do right desu. unless you have a math degree you're mostly cargo culting it. why learn an entirely new paradigm if you don't know how to use the shiny new toys?

Theres a reason for thise though OOP allows u to hire more brainlets.

Why is there no low-level functional language?