TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Object-Oriented Programming Is the Biggest Mistake of Computer Science

37 pointsby fireeyedover 4 years ago

22 comments

bob1029over 4 years ago
OOP is domain-specific in its applicability if you are following the original intent. If you are not strictly following the original intent of OOP, you can get the best of all known worlds if you apply strong discipline and your tools are capable enough.<p>For instance, in most OOP languages you can define your domain model as bags of facts without methods. Then, you could define a separate domain service layer that is exclusively permitted to mutate instances of those types. Next, you enforce immutability by defining a copy ctor for every type in your model. When you return anything to a caller from a domain service you always send a copy. Same idea on create&#x2F;update requests. The way I look at it, the domain services (methods) protect the model (facts) from unwanted mutations.<p>Having your facts separate from your methods means you can apply things like normalization and start to leverage functional and&#x2F;or relational techniques. Being able to query your domain model with SQL is next-level productivity if you can manage it.<p>So, the biggest mistake to me in computer science is not OOP, but the blind following of any one specific doctrine to an inevitable dead-end. Good software outcomes require an incredibly difficult balance between many ideologies, as well as conformance to actual realities presented by the real world (i.e. customer requirements, regulations, developers having bad moods, etc.).
S_A_Pover 4 years ago
A lot of powerful claims made in this article. Are we sure 737s crashed because of spaghetti code? As far as I am concerned the max crashes were due to a string of management failures pushing for wrong ideas.
评论 #25842002 未加载
Jtsummersover 4 years ago
This blog post seems to equate spaghetti code with OO, which is a false equivalency. I mean, yes, you can achieve spaghetti code with OO, but you can achieve some degree of spaghetti code in most paradigms.<p>It also seems to imply that OO has <i>cost lives</i>, specifically with the Boeing 737 Max MCAS system and Toyota&#x27;s &quot;unintended acceleration&quot; problem. But I can&#x27;t seem to find what language MCAS was written in (I&#x27;d wager C, Fortran, Ada, and possibly some assembly based on other Boeing systems I&#x27;ve been involved with). And Toyota was using C.
etaioinshrdluover 4 years ago
Lately I think that the React framework is the biggest mistake. It&#x27;s worse than a pile of jQuery spaghetti.<p>It&#x27;s probably single-handedly responsible for why Reddit, Twitter, and myriad modern popular sites are slower and buggier than ever. They are written in an un-debuggable framework...
评论 #25841979 未加载
评论 #25843797 未加载
评论 #25842123 未加载
Triv888over 4 years ago
I think that the biggest mistake is to switch to the next new programming language for no real benefit...
gchamonliveover 4 years ago
People still focuses a lot on procedures, algorithms and paradigms and tend to forget the simplest most basic aspect of computer programming: it is a language before everything.<p>It needs structure, semantics and good abstractions, so that we can better encode programmer intention into procedures, and not only rely on algorithmic effects to tell whether a program works.<p>I believe the software community would be in way better shape if we approached computer science a little bit more like linguistics. We would understand each other better, we would integrate ideas easier and work more cooperatively. But until code stops being just a tool to implement some end and until code quality stops being regarded as cost we will keep writing spaghetti code. Regardless of language. Because when the team culture tolerates bad code, bad code will arise, be that in java, c, python, rust, Haskell. Whatever.
falcolasover 4 years ago
Video game programming, where OOP actually maps pretty well to the problem domain, would beg to differ.
评论 #25842007 未加载
评论 #25841978 未加载
评论 #25841966 未加载
评论 #25841982 未加载
评论 #25847664 未加载
lxeover 4 years ago
&quot;Read the rest of this story with a free account.&quot;<p>No thanks.<p>But judging by the title, it seems click-baity. The &quot;biggest mistake&quot; is definitely not OOP. You can definitely abuse and misuse OOP, where other abstractions would be a better pick, but it&#x27;s not just universally bad.
37ef_ced3over 4 years ago
Go&#x27;s minimalist object-oriented approach (interfaces, embedding types within types, and associating functions with named types) is small, simple, and effective<p>No mistake about it
magicalhippoover 4 years ago
What I miss from articles like this, which make some rather grand claims about how poor OOP is and how much better X is, is less claims and more proof.<p>I really enjoyed the rs-pbrt[1] project that was posted here[2] the other day, as it allowed me to compare some non-trivial code in a (to me) different and interesting language.<p>Does anyone have some good comparative examples for FP? Doesn&#x27;t have to be as grand as rs-pbrt, but ideally something a bit realistic and non-trivial.<p>[1]: <a href="https:&#x2F;&#x2F;www.rs-pbrt.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.rs-pbrt.org&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25812330" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25812330</a>
a3nover 4 years ago
I wonder what things would be like today if the term &quot;message oriented programming&quot; had caught on instead.
评论 #25841929 未加载
评论 #25841972 未加载
blackrockover 4 years ago
OOP seems to force you to leave the entire codebase for that class open.<p>The member variables can be modified by the methods, which makes the variables a type of global variable, from the perspective of the method.<p>Then over time as your code size increases, you add more methods, and they keep modifying the member variables. Now, if you’re not careful, you can have multiple vectors modifying your member variables, any which way it wants.<p>Thus, when working with OOP, you can never seem to close out parts of the code that you had already completed and tested. Since the entire code base is opened for continual modifications.
评论 #25842071 未加载
评论 #25844920 未加载
评论 #25841983 未加载
kmonsenover 4 years ago
If all you have is a hammer you will eventually come across things that are not nails, but close enough you try to approximate them as nails. As the abstracts get more and more leaky you get the &quot;biggest mistakes&quot;. I don&#x27;t think really it matters what it is, if you take it too far it will fall apart.<p>I think clearly this applies to functional programming as well, and probably every other way of thinking.<p>The issue with OOP is that it is taught, and for many programmers they think it is the only way to think so they try to make every problem a nail.
_alex_over 4 years ago
Null is probably a bigger mistake.
评论 #25841977 未加载
评论 #25841988 未加载
评论 #25842021 未加载
评论 #25841930 未加载
blackrockover 4 years ago
This is not a very good article.<p>OOP has a lot of flaws for why it was a poor design decision, but this article doesn’t seem to address them.<p>Instead, it focuses on things like spaghetti code.
评论 #25842210 未加载
dvfjsdhgfvover 4 years ago
OOP is not &quot;the biggest mistake&quot;; following it blindly and applying to everything is. We saw this pattern then and we see it today.
renewiltordover 4 years ago
I think the greatest UX improvement in programming is namespacing. UFCS plus namespacing is enough to make people happy to not OO, I think.
评论 #25842213 未加载
dswt_mqover 4 years ago
ah, this strawman banging again. OOP is not mistake, there are too many weak developers.
评论 #25882740 未加载
alkonautover 4 years ago
I still hold type systems with null as being worse - but someone of course had to combine the two...
ano88888over 4 years ago
what is the alternative that we should use? functional programming? message oriented?
评论 #25842215 未加载
omar_khaover 4 years ago
do what works best for you.<p>Peace.
ddevaultover 4 years ago
Not going to enable javascript and&#x2F;or pay money to read this very hot take, but I can definitely agree that OOP is terrible. And, furthermore, spelled backwards it is &quot;POO&quot;.<p>Don&#x27;t use Medium, please.
评论 #25842031 未加载
评论 #25842149 未加载
评论 #25842134 未加载