Which do you prefer Jow Forums? FP or OOP?
>inb4 30+ min videos get posted on why X is better than Y
FP vs OOP
Other urls found in this thread:
youtube.com
en.wikipedia.org
twitter.com
procedural programming
i like functional programming more just because it makes more sense to me. object oriented programming gets really confusing after a while especially if you use its features like inheritance and prototyping in a very large codebase.
i pretty much only use objects when i work with external data. for exampl I/O operations from reading or writing data or fetching or sending things via an api just to have them stored in a convenient way for processing.
its really just preference for me. maybe im a codelet but so far it has worked well for me and everyone at work seemingly seems to adopt the same coding style as me for some reason ever since i started working there.
FP + OOP + Stack
youtube.com
Object Oriented programming is inherent even in functional programming. Ultimately, programming languages are just noun+verbs (variables/functions) like any other language and anyone with a high capacity to abstract should realize that even primitives can be viewed as objects (although very simple they have operations/verbs that apply to them).
In terms of an official "OOP" language, this is mostly a syntactic convenience. Almost every "OOP" feature of C++ can be applied in C - it just lacks the convenience and uses a different syntax to C++ (struct vs class, for example).
Additionally, in my opinion, where C++ fucked up was that member functions should have simply been shorthand for:
void someFunction(ThisClass *thisClass, int someArgument);
When accessed as thisClass.someFunction, compiler should've compiled to the above. This would've allowed for better integration with native C. Would be curious to hear a justification as to why this wasn't done.
Why not both?
In all relevant ABIs that is exactly what happens - 'this' passed in first argument slot, and then called just like a normal function.
I don't really understand how that would allow better integration with C, but one problem with that approach would be that it would completely expose private and protected members.
It's funny that this is what Python does anyway.
Both
this
Think of it in terms of a replacement to a "functor".
Compiler could easily protect against that. Private/Protected have no relevance in terms of what I am talking about.
Yeah - but not in practice. You cannot do this with C++.
Python is for submissive cucks who get off on being told how to format their white-space (trigger warning). In all seriousness, it might be a sensible language from that point of view, but it's a pain in the ass to actually program in, syntactically.
Fpbp
Ultimately the problem is that OOP is a neofeminist construct. It tries to deconstruct the notion of "objectification" by implying that objects "do" something.
In reality, the traditional way is logically more sane. OOP makes the simple mistake of treating the "object" of a sentence as the "subject" and acts as if objects can do something.
No, "objects" have things done to them. They don't "do" things.
This is why FP and simple imperative programming are superior and more simple. The "verb" or "subroutine" or "function" is what does the action to a data structure. The function is both subject and verb, which makes more logical sense than trying to coerce the "object" of a sentence into the "subject" of the sentence
actor model because it's easy to verify
then OOP, CSP and functional is equivalent
F fucking pbp
data-driven programming is the only sane paradigm if you REALLY care about user quality of life, device performance AND battery life.
Write code for your machine, not the basedboy manchild that will take over after you, this is what comments, docs and technical papers are for.
oop should die as it's unfit for most modern problems
fp alone is still a lab-friendly paradigm and you won't see many fp-based programs, it does not produce better code that "standard" imperative code but is easier to optimize than oop.
Also people have to stop considering generics as a oop feature, it's not and if your teacher says otherwise, leave the room, you have nothing to learn from this retard.
post resources on that
about what ?
data driven is good old procedural right?
i like functional but i know its just a meme and OOP is more suited for industry.
functional is the way mathematicians think and OOP is the way engineers think.
Functional and procedural and data driven all seem the same to me but I think I’m thinking too much like a non-CS person and taking the names literally...
If anyone wants to help differentiate them?
based
>grug speak noun+verb
>every abstraction is noun+verb
oop? Oog oog
yes but with modern tools.
>functional is the way mathematicians think and OOP is the way corporate engineers think.
ftfy
oop is a corporate-oriented programming paradigm. It exists purely so your clueless n+1 can keep an eye on whatever cryptic (from his pov) shit you're doing.
They have some oracle db knowledge and it's cool for them to have the same structures everywhere else.
inheritance is retarded and every modern language does not want to deal with it (does not exist in go or rust for example)
design pattern are glorified modules you can find in C except it's trash and does not work as intended.
private keyword is not enforced in java, protected does not work as intended in C++ and so on.
If language devs themselves, even after decades, are not sure what to enforce and what not then ask yourself why it exists in the first place.
We now have decades of oop and we can se the result: it does not work in real life.
Came here to post this
The programming language itself should be primarily procedural, with (standard)libraries and frameworks built to support OOP, FP and other paradigms.
>OOP is the way engineers think
Except good engineers prefer to keep everything simple and stupid, which OOP is the opposite of.
>OOP is a neofeminist construct
this is what it looks like when a poltard learns who Emma Goldstein and Grace Hopper are
remember kids— stick to drugs, there are worse ways to ruin your brain
I feel FP is more OOP than OOP itself.
In FP everything is a "thing": a box with memory? a thing. A set of imperative instructions? a thing. The flow of execution? a thing. Of course I have to say "thing" because the word "object" means something else in programming.
If they had called it Set and functional oriented programming instead of functional programming I think people would be less confuse about it.
Javacucks BTFO!!!!!
OOP is utter shit and has no reason to exist. FP is logical, better, not a clusterfuck and it's written in a way closer to how the computer behaves.
When I started doing functional programming I wondered how could I solve real world problems because it seemed so alien at that time, now I wonder how can I solve a real world problem in an OOP style, procedual is OK since at some point you'll have to thread state in some way or another.
>FP is logical and it's written in a way closer to how the computer behaves.
what the fuck are you smoking dude?
OOP is part of FP
(define (make-account money)
(lambda (movement)
(set! money (+ money movement))
money))
(define account2 (make-account 100))
(account2 -10)
it is if you look closely what the compiler/interpreter is actually doing, since it's all based on computations that can be expressed in simple instructions that yield new values and structures, since OOP is just procedual style surrounded by unnecessary crap the compiler has to be more conservative in the optimizations and assumptions it makes, for example referential transparency and stream fusion
Use scala and do both at the same time
Traits, case classes and object literals make me hard
oracle didn't make java, sun microsystems did
still, i agree with the spirit
>not writing ASTs only in elixir
First for Erlang, also isnt erlang compiled to c code in the end?
what fucking autism is this?
If you want to be paid, go OOP.
If you want to fool around, go functional.
Lite functional programming is my preferred approach (pure functions, local mutation).
I like OOP as a concept, but I hate the way it's implemented. It should essentially be a bunch of mini-programs that interact with eachother, but instead it's a convoluted clusterfuck where you basically need to program a program to program a program
>program a program to program a program
isnt that the goal ?
FP is far and away more abstracted from machine instruction than any other language paradigm. This is patently false.
This is also why FP is superior to imperative languages, because humans are not computers. It is the best kind of abstraction.
based
incredibly based
OOP seems nice in theory, but in practice you eventually end up with a huge clusterfuck. Trying to fit everything into objects is a mistake, and design patterns are an ugly workaround for that.
Even if you come up with a great abstraction for everything that makes it initially look nice and tidy, some time later you end up having to add some feature that just doesn’t fit and you’re fucked. Sooner or later everything has a reference to everything and you have a complete abomination. OOP brings more problems to the table than it solves.
Based Schizo poster
The one place where I've found OO to be quite sane and natural is embedded programming.
Peripherals and various device drivers is all about managing a bunch of mutatable state with certain operations maintaining invariants (correct group of flags set/cleared, groups of register set to certain values, etc).
Often you only have one or a few objects och each type, and not alot of data to churn through (so data oriented makes no sense).
There are natural hierarchies - you might have several timer peripherals where all share some common basic functionality, but some might have extra features like qudrature decoder or able to generate events on some bus - the common functionality share register offsets, and extra features are added onto, so pretty much perfect match for inheritance.
logic programming > FP > OOP
Only brainlets cannot comprehend.
based.
This is a super hot take that Jow Forums just isn't ready for.
Based and functionpilled
Functional every time. There was never a thing I could do with an object I couldn't do with a function acting on a struct or other product type. Immutable or mutable reference, doesn't matter. Basically every feature of C++/Java/C#-style objects is ultimately pointless.
Once every language has software-transaction references to data and you can put structs or records in them, it's game over. OOP is dead.
Functional core, imperative shell.
>data-driven programming
what the fuck does that even mean
>software-transaction references to data
What does that even mean?
STM is a reference with built-in synchronization semantics such as mutexes, so all accesses are thread-safe.
en.wikipedia.org
Clojure has them built-in with the "atom" function. You can basically treat any data you put into an atom like an object or other shared memory data, and it does the hard sync work for you.
Isn't this data-oriented design and not data-driven programming?
Both + ...
Hot take: Functional is better than OOP, but functional languages should support object data types.
what is an object data type