The Problem with Object-Oriented Programming
Skills:
Systems Design Basics80%
Key Takeaways
The video discusses the limitations and drawbacks of Object-Oriented Programming (OOP), highlighting how it can lead to abstraction, complexity, and over-optimization, and how it may not always be the best approach to solving real-world problems. It also touches on the SOLID principles and their role in OOP.
Full Transcript
so let's see what he has to say about object oriented and I technically pre-at this but it's interesting what one of the big problems with software right is that starting in the 80s prior to the 80s everybody was just trying to solve real problems and trying to get computers to solve real problems right and then start I hate to interrupt like 13 seconds into the video but this is partially what I was saying and I hate too much abstraction in the older days there was obviously less distraction because as more time goes on we get better ways of doing things higher level programming languages right like Java has more abstraction than something like C where you are closer to the hardware layer that's what I mean by the word abstraction and so this is especially prevalent in front-end development where you hardly even know what's going on under the hood anymore I bet a lot of front-end developers hardly even know like what a web API is but anyways let's continue starting around the 80s computers got fast enough that you had a lot more leeway around how you solve the problems and people started making all these theories about how to uh how to solve problems in the best way and so object-oriented programming is like one of those theories right oh on the list of things in C++ that are wrong objectoriented is wrong right because of course um uh Alan K invented the term object-oriented and it meant something else it meant small talk not C++ I'm not sure what he's talking about there I mean I believe him I assume he's right anybody who's older in programming is usually right the inventor of the term object oriented he's often quote as saying what we call is not what he metant I made up the term and I can tell you I didn't have C++ in mind okay well I'll just believe him so like even the term objectoriented is wrong the way people use it anyway so people came up with all these ideas about how to program and then the problem is those ideas require entire belief structures right so if you go to program in C++ object-oriented World representation style then you start to believe from the way that you're taught that programming work is about building the hierarchy of objects in the right way or something but that's not actually solving a problem it's just conforming to a belief structure that you've been given after you've decided on that hierar of objects you still don't have a program that solves any problems now you have to go write the program within that framework that you decided on right so I watched this video the other day I don't even remember what he says in the rest of it but regardless of what you believe and what programming Paradigm you ascribe to what he just said is 100% correct right object-oriented programming itself doesn't solve a problem it's just away and and he's right you get to a point where now you're not actually dealing with like the code that solves a problem now you're dealing with the higher level thing and maybe I'm using this word wrong but I don't think I am the abstraction now you add that layer of objectoriented programming abstraction on top of everything and you're making your functions dance behind classes to have this weird hierarchy you can't program like that unless you actually understand the world of object oriented programming all the principles open close this that it does take you away from being able to solve those problems in some way it adds like a layer of complexity now the reason it was created in the first place there is a reason because some problems are hard and object oriented programming can simplify a lot of really complex problems it makes sense that it does exist and so the problem is as we get further and further away from real actual problems more and more of what is taught to people as programming is actually not doing anything it's just shuffling papers around on your desk right and so like the question of how do I do an interface that blah blah blah is just shuffling the papers around on your desk because it's not actually solving a problem like what I would say is write the editor and then write the plugins or whatever write the functionality make all the functionality work and then if you're dispatching between them with an if statement and it feels kind of hacky and you need more abstraction for a very concrete reason then put in a function pointer but I wouldn't even do that I would just have an if statement that turns them on or off for a long time because it's it's actually a relatively that part of writing an editor is so small and so another thing I agree with with what he said and I was actually reading an article about like solid principles this is why I'm going to make this point but people talk a lot about the dependency inversion principle like you should depend on abstractions and all that even even if there's only one implementation of an interface or just one instance of a class that's going to be a dependency basically what I'm getting at is like if you've ever programmed in Java before like an existing codebase you see that a class has dependency a you go to the definition of dependency a it's an interface okay so you actually want to see the implementation you want to see the actual functions in the code for class A then you have to find okay what implements Class A you find a class it's an abstract class you're just trying to look for the damn like implementation just the actual code not all these empty interfaces and Abstract classes sometimes it's just so annoying first of all people feel the need to like over optimize or prematurely optimize things everything needs to be extensible even though I just have like five classes why does it everything have to be abstracted like what if 10 years from now I want to adds a different dependency to this class well I got to make it extensible why not just refactor it at that point point I'm not saying there's a perfect solution depending on how big your codebase is what the company standards are and all that fine but I think people do like especially like the way it's taught in school the way it was taught to me it's like these are like the principles and you shall not break these programming principles but if you're going to be like practical sometimes it's better to sometimes it simplifies the code in terms of what it solves that I wouldn't even bother for a long time um on the other hand if you buy into a weird structure or many weird structures which is what happens in order to preemptively solve this very small problem before it becomes a problem you end up taking on all these very large belief structures that are actually very hard to conform to and you have to conform to those belief structures all the time because that's what that's what you made your program be and it actually gives you a much bigger job to do than you actually have to do to solve the actual physical problem that you have in the objective world world all right so that's that's the the best thing that I can say about this I mean it's just so true like how can anybody disagree with this video because he's right like what if you wrote some code that perfectly solves a problem but there's some violations of the solid principle sprinkled in there well that could be an indication that your code just kind of sucks fine and true that can happen like you can there is a such thing as just really badly written code but you have code that solves the problem now you have a second problem you have to make sure your code follows certain principles like he said they're not always easy to conform to it's not easy to make your code follow all the objectoriented programming principles I saw this mentioned in another video before we won't watch the whole video cuz it's 45 minutes but I would recommend anybody go watch this video if you want to learn more about why object oriented programming is bad and when I say bad I I use object orent programming I've used it I don't think it's like the devil but the way he describes it it's basically assembly line programming developers are too dumb to make code that works so you got to give them like building blocks and rules to make sure that they follow so that code can always be readable and extendable by like a new Dev team that joins and things like that
Original Description
🚀 https://neetcode.io/ - A better way to prepare for Coding Interviews
Clip from the video: https://www.youtube.com/watch?v=04ksL1hf_p8
I stream on my main YT channel: @NeetCode
🧑💼 LinkedIn: https://www.linkedin.com/in/navdeep-singh-3aaa14161/
🐦 Twitter: https://twitter.com/neetcode1
#neetcode #leetcode #python
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from NeetCodeIO · NeetCodeIO · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Leetcode 149 - Maximum Points on a Line - Python
NeetCodeIO
Design Linked List - Leetcode 707 - Python
NeetCodeIO
Minimum Time to Collect All Apples in a Tree - Leetcode 1443 - Python
NeetCodeIO
Design Browser History - Leetcode 1472 - Python
NeetCodeIO
Number of Good Paths - Leetcode 2421 - Python
NeetCodeIO
Flip String to Monotone Increasing - Leetcode 926 - Python
NeetCodeIO
Maximum Sum Circular Subarray - Leetcode 918 - Python
NeetCodeIO
Find Closest Node to Given Two Nodes - Leetcode 2359 - Python
NeetCodeIO
Concatenated Words - Leetcode 472 - Python
NeetCodeIO
Data Stream as Disjoint Intervals - Leetcode 352 - Python
NeetCodeIO
LFU Cache - Leetcode 460 - Python
NeetCodeIO
N-th Tribonacci Number - Leetcode 1137
NeetCodeIO
Best Team with no Conflicts - Leetcode 1626 - Python
NeetCodeIO
Greatest Common Divisor of Strings - Leetcode 1071 - Python
NeetCodeIO
Shortest Path in a Binary Matrix - Leetcode 1091 - Python
NeetCodeIO
Insert into a Binary Search Tree - Leetcode 701 - Python
NeetCodeIO
Delete Node in a BST - Leetcode 450 - Python
NeetCodeIO
Shuffle the Array (Constant Space) - Leetcode 1470 - Python
NeetCodeIO
Fruits into Basket - Leetcode 904 - Python
NeetCodeIO
Number of Subarrays of size K and Average Greater than or Equal to Threshold - Leetcode 1343 Python
NeetCodeIO
Naming a Company - Leetcode 2306 - Python
NeetCodeIO
As Far from Land as Possible - Leetcode 1162 - Python
NeetCodeIO
Shortest Path with Alternating Colors - Leetcode 1129 - Python
NeetCodeIO
Minimum Fuel Cost to Report to the Capital - Leetcode 2477 - Python
NeetCodeIO
Count Odd Numbers in an Interval Range - Leetcode 1523 - Python
NeetCodeIO
Contains Duplicate II - Leetcode 219 - Python
NeetCodeIO
Path with Maximum Probability - Leetcode 1514 - Python
NeetCodeIO
Add to Array-Form of Integer - Leetcode 989 - Python
NeetCodeIO
Unique Paths II - Leetcode 63 - Python
NeetCodeIO
Minimum Distance between BST Nodes - Leetcode 783 - Python
NeetCodeIO
Design Hashmap - Leetcode 706 - Python
NeetCodeIO
Range Sum Query Immutable - Leetcode 303 - Python
NeetCodeIO
Binary Tree Zigzag Level Order Traversal - Leetcode 103 - Python
NeetCodeIO
Middle of the Linked List - Leetcode 876 - Python
NeetCodeIO
Course Schedule IV - Leetcode 1462 - Python
NeetCodeIO
Single Element in a Sorted Array - Leetcode 540 - Python
NeetCodeIO
Capacity to Ship Packages - Leetcode 1011 - Python
NeetCodeIO
IPO - Leetcode 502 - Python
NeetCodeIO
Minimize Deviation in Array - Leetcode 1675 - Python
NeetCodeIO
Longest Turbulent Array - Leetcode 978 - Python
NeetCodeIO
Last Stone Weight II - Leetcode 1049 - Python
NeetCodeIO
Construct Quad Tree - Leetcode 427 - Python
NeetCodeIO
Find Duplicate Subtrees - Leetcode 652 - Python
NeetCodeIO
Sort an Array - Leetcode 912 - Python
NeetCodeIO
Ones and Zeroes - Leetcode 474 - Python
NeetCodeIO
Remove Duplicates from Sorted Array II - Leetcode 80 - Python
NeetCodeIO
Maximum Twin Sum of a Linked List - Leetcode 2130 - Python
NeetCodeIO
Concatenation of Array - Leetcode 1929 - Python
NeetCodeIO
Symmetric Tree - Leetcode 101 - Python
NeetCodeIO
Check Completeness of a Binary Tree - Leetcode 958 - Python
NeetCodeIO
Construct Binary Tree from Inorder and Postorder Traversal - Leetcode 106 - Python
NeetCodeIO
Find Peak Element - Leetcode 162 - Python
NeetCodeIO
Accounts Merge - Leetcode 721 - Python
NeetCodeIO
Binary Tree Preorder Traversal (Iterative) - Leetcode 144 - Python
NeetCodeIO
Binary Tree Postorder Traversal (Iterative) - Leetcode 145 - Python
NeetCodeIO
Number of Zero-Filled Subarrays - Leetcode 2348 - Python
NeetCodeIO
Minimum Score of a Path Between Two Cities - Leetcode 2492 - Python
NeetCodeIO
Sqrt(x) - Leetcode 69 - Python
NeetCodeIO
Successful Pairs of Spells and Potions - Leetcode 2300 - Python
NeetCodeIO
Optimal Partition of String - Leetcode 2405 - Python
NeetCodeIO
More on: Systems Design Basics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Bloom Filters, Explained Properly
Dev.to · Daksh Gargas
Prefix Sums: The Preprocessing Trick That Makes Range Queries Instant
Medium · Programming
I Thought I Was Ready for the Interview — Then One Simple Math Question Destroyed Me
Medium · Programming
Week 2(Day 10): LeetCode Two Pointers(slow & fast): Remove Duplicates from Sorted Array (Brute…
Medium · Python
🎓
Tutor Explanation
DeepCamp AI