r/AskComputerScience • u/og-cheeselover97 • Dec 30 '18
Why do alot of people hate OOP ?
In University and Business places you're taught to like oop and for the most part , I've actually really liked oop because of the mindset and how you approach problems . It makes things easy for me to imagine problems as black box components that do things and they connect to each other.
I see alot of people that really hate it . I've programmed in lots of languages , but haven't had pleasure to dabble with c. I started out with Java then to c# , Php , c++, JavaScript ( I regret it) , and python . With all of those languages I've always made OOP work for me and never had a problem , except when it gets a little verbose.
someone kindly explain why you hate it or why do you think people hate OOP.
33
u/Bowlslaw Dec 30 '18
Itâs more difficult to understand for newbies than is conveyed
Itâs pushed in universities like itâs the next coming if Jesus.
5
u/794613825 Dec 30 '18
My second introduction to programming (first was on a TI calculator) was OOP, and it was very intuitive for me. Do people really struggle with it that much?
1
u/MysticPaul97_YT Jul 08 '23
Apparently they do. I'm learning Java as my first programming language, and so far it is very nice. No complains about the verbose thing, any language can and will be verbose if you repeat yourself a lot.
1
u/wellseymour Jul 10 '23
Bro if that's literally the first and only language you know, what exactly are comparing it to?
1
1
Jan 28 '24
Well, trying to say that a chunk of code is a dog that goes woof is a really hard concept to get around surprisingly.
No that's not a dog. That's a block of code. YOU CAN'T TELL ME OTHER WISE!
1
5
Aug 23 '22
I never had issues understand OOP its actually pretty simple and i do think its easier than functionial programming
1
2
u/flyingpinkpotato Dec 30 '18
These reasons donât seem very convincing. How do these affect the efficacy of OOP?
2
u/dragonwithagirltatoo Dec 31 '18
I think he's saying that's why people criticize it, nit necessarily that those are actual problema with it.
1
1
u/jonfoxsaid Apr 04 '24
Sorry to necro this but I just wanted to say this:
I once read an article about FizzBuzz when I first started coding ... the article talked about when it was a common interview question and how about 90% of programmers (mostly with CS Degrees) where unable to solve it OR provide a solve for other similar style problems.
I learned how to solve something like Fizzbuzz in my first week of python and got stuck on having the statement in the proper order, I did not know much yet, Took me about 20 min and tons of different solutions that did not work to realize "OH I was right in the first place but if i don't check for FIZZBUZZ first it will never get printed because of how if/else statements work!
Then that concept clicked and I never had trouble with stuff like that again, its just something that I consider naturally when I write an if/else statement.
I said all that, just to say this ... People would rather say something is too hard than just work through it and learn. A kid who got hired at my job in the same batch I did conversed with me about python a bit one day, he said "I tried to learn it but got to libraries and it was too hard so I gave up". like what ha-ha. Coincidentally that same kid got fired in his first week.
Learning OOP was not hard for me, the concepts made sense right away. but I think that is because I have a solid teacher who really set us up for it.
1
-2
14
u/ComputerSystemsProf Dec 30 '18
Are we counting imperative programs with a few objects as OOP, or are we only counting fully âeverything is an objectâ programs?
One of the arguments against âeverything is an objectâ style programming is that in real world programs you start having to create abstractions that donât make sense, and sometimes that actually makes your code harder to understand.
Also, one thing about classes is that non-const methods are not âpure functionsâ by definition. (Although some of the drawbacks of that can be mitigated.)
8
u/wackyvorlon Dec 30 '18
In my experience, many people fuck up OOP badly. It's not applicable everywhere. IMO, if your entire program is in a giant "App" class, you have fucked up OOP.
1
u/MysticPaul97_YT Jul 08 '23
OOP is designed for something specific. If you don't need to use the advantages and deal with the disadvantages of OOP, then just don't use it.
I think people hate it because they've tried to use it for things it isn't applicable and therefore think that the problem is OOP itself and not them using it incorrectly.
7
u/Mukhasim Dec 30 '18
This is a pretty extensive listing of things that people think are wrong with OOP: http://wiki.c2.com/?ArgumentsAgainstOop
15
u/ReginaldDouchely Dec 30 '18
A lot of people think they understand it and do a very poor job of creating code that can be used as a black box of components that can do things. Lots of programmers can't or don't take the time to step back and think about what it'd be like for another developer to use their objects.
:(
10
u/autoshag Dec 30 '18
Personally I prefer composition over inheritance, and OOP tends to lend itself to inheritance, but if you know what youâre doing, you can still use OOP for composition.
8
u/midwayfair Dec 30 '18
Personally I prefer composition over inheritance, and OOP tends to lend itself to inheritance, but if you know what youâre doing, you can still use OOP for composition.
One of the core principles of Object Oriented Design is to favor composition over inheritance. You don't seem to encounter the need for it in intro classes, so I can see why people might not get much practice in doing that. (Not disagreeing with you or anything, just expanding on the "if you know what you're doing" part.)
5
u/HoldThisBeer Dec 30 '18
They never taught about composition at the university, only inheritance. Never meat a professional developer who favored inheritance over composition. Go figure.
5
Dec 30 '18
OOP as a set of language features is somewhat tolerable, although inferior to more powerful module systems. And most of the people are only using OOP as a poor men's module replacement.
OOP as a way to model reality is just wrong most of the time, and yet, proponents are insisting on shoehorning all the real world complexity into this idiotic hierarchical taxonomy of communicating objects. There is always a much better model to represent any problem domain imaginable than an OOP. The only exception is multi-agent simulations, and it's also far from what most people perceive as an OOP - objects must communicate asynchronously.
Also, I'd recommend to read this: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
9
u/metaobject Dec 30 '18
Itâs a perfectly fine tool depending on the language being used and the problem being tackled.
4
Dec 30 '18
Next time you encounter someone who hates OOP, ask them âwhat do you prefer instead, and why?â and youâd get your answer.
OOP is a surprisingly powerful tool for abstraction and it has proven itself over many decades of real-world use. Many people are pushing for pure functional design these days, but thereâs still not any better pattern for manipulating intentionally stateful, mutable data structures.
1
u/srk_007 Nov 27 '22
I actually like procedural programming. Something like C over C++/Java. Why because:- It is easy for me to code in C. I think Object orientation is not something that humans are designed to think inherently. And more importantly may be I don't understand the advantages of OOPs so much. Kindly enlighten me regarding the advantages. May be even when I read about it, I don't feel the advantages when I code.
1
u/srk_007 Nov 27 '22
It is much more easy"for me" to understand for loop and while loop than memorize/understand/find use of Multiple inheritance, Diamond problem, Interface, Abstract classes etc.
1
4
Dec 30 '18
Object Orientation can often become an ends in itself. You can feel productive making a number of classes and not actually achieve much. Object orientation is also more susceptible to "semantic drift", where the meaning of your classes change over time in a project. What is a "Customer" is a far more difficult philosophical question than "what does the ProcessCustomerOrder function do?" (It is self-descriptive, it processes customer orders of course)
3
u/TinyLebowski Dec 30 '18
What is a "Customer" is a far more difficult philosophical question than "what does the ProcessCustomerOrder function do?" (It is self-descriptive, it processes customer orders of course)
I don't see how that helps. The concept of what a Customer is can change over time, regardless of how you structure your code. And when the semantic meaning of Customer (or Order for that matter) changes, so does the meaning of ProcessCustomerOrder.
1
Dec 30 '18
TLDR: Definitely true, I just feel it can incorrectly preempt the design process.
Yes, my statement was poorly posed in retrospect, and you are completely correct in your response. The thrust of my opinion is really that OOP design feels top-down. We establish ideas like "Customer", "PaymentMethod" and "Product", believing they must be crucial parts of business logic, before writing any business logic. This forces us to create relationships that may not actually be there, but are nevertheless difficult to change in mature systems. There is like an implicit global scope of concepts that any new class inherits, on top of the explicit inheritance we give it. I must admit that I have not developed these ideas enough to write them down as succinctly as I would like. OOP is still certainly useful, it just has limitations.
1
u/arvndpndy Dec 30 '18
First time I Heard that đ
1
u/og-cheeselover97 Dec 30 '18
Watch any YouTube video "WHY JAVA AND OOP SUCKS "
2
u/arvndpndy Dec 30 '18
Now search why oops and java rocks,YouTube will give results whatever you search.
16
u/George_Rockwell Dec 30 '18
A lot of people who hate it can't do it.
9
u/JVO1317 Dec 30 '18
This. Having a class with a lot of methods is not OOP.
3
u/SteeleDynamics Dec 30 '18
True. A class just containing a bunch of methods should really be a namespace with static methods.
OOP is used in CLRS and it does make teaching algorithms much easier. Having an object with attributes and passing that object by reference does simplify the function interface for explaining algorithms.
I mainly use modern ISO C++, but I can program in different styles with it.
1
Dec 30 '18
So aside from having a class with methods, what else defines 'true' OOP?
1
u/George_Rockwell Jan 16 '19
The relationships and message-sends between different Objects is what defines Object Oriented Programming.
Taking a look at the system context as a whole, then delegating tasks and behaviors to decoupled classes is the heart of this.
7
2
u/philwen Dec 30 '18
It's easy to write really bad, unmaintainable code. And the majority of us had to work with legacy code bases which are "OOP" and had a "textbook" layer architecture. But in reality it is a huge fucking monolith consisting of 3 layers of spaghetti...
Taking the time for creating a well structured non-anemic domain model takes time which often isn't possible. But it's more or less a requirement for having a well maintainable software (IMHO).
Tl;Dr it's easy do create a nightmare of code. But that's true for every paradigm. OOP is just old enough so there are many legacy codebases out there which are OOP-done-wrong...
2
u/pilibitti Dec 30 '18 edited Dec 30 '18
In my experience the crux is the following:
If your application does something non-trivial, the "parent - child" analogy sometimes breaks down spectacularly. Sure, the idea is elegant, it is particularly elegant for programming minded folk. That's a huge reason why it caught on - and it did create lots of productivity gains compared to what people were programming before. But the fact of the matter is, real world entities do not adhere to the taxonomy regular OOP languages forces you to use.
This mismatch with reality manifests itself in countless architectural problems that plague basically ALL software that tries to adhere to OOP.
Some things can be represented like a tree in a regular OOP hierarchy. Alas, many other things can't be represented that way - and the poor fit is not obvious if all you have is a hammer. Or things start being representable in such a fashion but future requirements break that - but by then there is no turning back so from then on, all you do is hacks (or you should pay the price for a huge refactoring which rarely is practical - and it can be in vain, a future requirement can still break things) - your elegant source code gradually rots with added complexity and non-obvious conditionals to make something fit in your once-neat hierarchy.
2
u/lotyei Apr 29 '19
it's just horrendously taught. the majority of STEM is horrendously taught. 99% of eng students are auto didacts out of necessity.
STEM teachers suck at teaching OOP, thus students hate OOP. simple
1
1
u/srk_007 Nov 27 '22
Especially they don't explain the advantages and scale at which those advantages apply.
2
u/jonrgrover2 May 02 '19 edited May 02 '19
I dislike OOP only because of the behavior of the people who do it. They tend to be rigid, and inflexible and believe that things that are not standard or best practices are wrong. They tend to be overly critical tyrants, not supportive or encouraging. They seem to dislike experimentation and exploration, and if I try to do any other kind of programming, they look appalled. I actually enjoy programming OOP myself, but OOP attracts a crowd of people I find very difficult to work with. I have 30 years programming experience, including 15 years OOP, and yet they look at me like I have two heads, which perhaps I do, since I use both object oriented programming and information oriented programming. And OOP people don't get or understand information.
1
u/glowgloves May 07 '22
This applies to any programmer who argues exclusively in favor of a single paradigm for all problems
2
Dec 30 '18
People who favor functional programming over OOP tend to care about:
the ability to reason about a program using mathematical principles
logical and theoretical soundness of the programming language
formal correctness and verifiability of programs
Paradigms like functional programming, logic programming, imperative programming, and concatenative programming are based on a theory of computation, so users can apply a simple set of principles to reason about their code and how it will be executed. OOP is based on analogies and adboc features, so it doesn't provide any of this (see https://stackoverflow.com/questions/3113368/theory-behind-object-oriented-programming). That doesn't mean it is a bad way to program, but it is an important tradeoff to consider.
2
u/bartturner Dec 30 '18
People who favor functional programming over OOP tend to care about:
They do not necessarily compete with one another. You can have both.
3
Dec 30 '18
Good point: it is entirely possible to use a mixed paradigm language to great effect. As an OCaml programmer who has made use of the object system before, Iâve witnessed this first hand. However, to the extent that we move code into OO, we give up the guarantees and conceptual purity promised by FP. Of course, in practice, some such compromise is always made (with impurity, addition of ad hoc features or limitations, etc), so itâs always a matter of degree.
My remark here only addressed the costs of using OOP, as that was the main question posed.
1
1
u/Legal-Country-8663 Nov 13 '24
I never had issues understanding OOP techniques, thanks to my awesome prof at university,
I believe people hate OOP because it generally demands more overhead in code and architecture.
1
May 20 '22
because most people don't know what they're doing and they make a shit code base all for the sake of "OOP" ooh la la. It's just a tool, yet it's only useful in the right hands.
1
Oct 13 '22
Why do you "i regret it" for Javascript? same reason why people in functional programming hates OOP
1
u/riookoo Feb 03 '23
watch this, I think it explains pretty well shortcomings of oop: https://www.youtube.com/watch?v=QM1iUe6IofM
1
1
u/CptCthulhu Sep 17 '23
OOP sounds good at first because it models the initial problem well as it is understood initially. However, to maintain that model, much refactoring must be done when coders realize that their model didn't quite fit the system. At that point, they inevitably make quick hacks instead.
There is only a very narrow set of use-cases where inheritance is actually ideal. Prefer composition over inheritance the vast majority of the time.
1
1
u/Sprayquaza98 Dec 30 '18
If we're talking about people as in undergrads, probably because OOP is their first real obstacle that may be tough to overcome i.e. their data structures/algorithms class. Thus, they immediately attach hate to it.
Side note: i worked with both c++ and c but only for a little bit but here's my 2 cents. I think they're pretty similar, since one is just an extension of another. Probably not the best use of time to learn C, though it might be helpful, idk
6
u/dragonwithagirltatoo Dec 30 '18
Manadatory c++ isn't a superset of c and if you use c++ to do c things you're using it wrong.
1
u/jpflathead Dec 30 '18
Oop sounds like mistakes were made. I've always preferred Better Loop Oriented On Programming, it always sounds happier
0
-3
u/Lofter1 Dec 30 '18 edited Dec 30 '18
I personally don't HATE oop, but i kept away from it for a long time.
Many people have plenty reasons for it, some good, some are just bullshit.
One of the reasons is c. good ol' c. because c isn't oop and c "is da best!", oop is bullcraps! sounds logical, doesn't it? yeah, who doesn't love them c elitists?
Another reason is that oop is kinda another abstraction from the hardware. Not that big, but big enough for some people to rather stay away from it.
Than oop can(! it doesn't have to) bloat your program. or even making it less efficient, which (together with the reason above) is a huge turn-off for hackers out there (i mean the oldschool hackers. not the ones you know from media. the chaos computer club kinda hackers)
another reason is that most popular languages that use oop may have a bad reputation for some people or similar. java for example. i've rarely seen hackers use java and many people hate on java. or take javascript, which is a mess, especially when it comes to oop. and c++ also isn't 100% oop-oriented to keep support for c (and torvalds likes to shit on c++ devs)
there are plenty of reasons not to like or at least not to use oop, as well as there are plenty of reasons to like or use oop. some people just want their program to be easy to read and easy to edit (which oop is good in) others want it to be as efficient as possible (which oop makes harder)
-1
u/rawoke777 Dec 30 '18
check out go-lang. The language has some pros and cons for discussion another time. but i like their model. Its like c structs with functions... less than OOP more than plain C.
28
u/[deleted] Dec 30 '18
Ask this to a functional-programming-related community