4 ms·
I think bad OOP is still better than bad functional code. Having seen what happens when a React codebase reaches >100k LOC are we really any better off than a c
by faizshah 2y ago
I think bad OOP is still better than bad functional code. Having seen what happens when a React codebase reaches >100k LOC are we really any better off than a class hierarchy?
The OOP model fits nicely into most people’s heads because of the analogy to the real world and OOP implementations generally seem to give better signals when you are doing something wrong. Rather than functional implementations which mainly rely on human expert code reviewers and linters to give negative signals instead of say exception hierarchies.
A lot of the time you don’t realize your codebase is bad until “it’s just a button how hard can it be” somehow takes 3 months and 4 rollbacks.
At least this is what I have observed working on large codebases.
- veidelis 2y agoI assume you're talking React's hooks. That is not functional programming.
- gorjusborg 2y ago> The OOP model fits nicely into most people’s heads because of the analogy to the real world It also has been the default programing language paradigm for a while now, which I think explains why experienced programmers can cling to it despite its drawbacks. Try to teach object oriented programming to a beginner and it becomes clear that it isn't as natural as you are suggesting. > generally seem to give better signals when you are doing something wrong. Better than what? Functional programming is a far simpler abstraction: a function. Data in, data out. That's about as simple as it gets. Also, culturally, functional programmers generally understand the downside of distributed state, and actively try to minimize it. That's a good thing. Bad code is bad code, but OOP gives you unique weapons to hurt yourself with. Inheritance allows one to change an unbounded number of objects without you even knowing. Modeling everything as a collection of objects with state tends to lead to programs that need to synchronize distributed state rather than a central state that is easier to keep consistent.
- Fire-Dragon-DoL 2y agoThat's because the programming language used is not FP, even if people pretend to. Js is still stateful everywhere, even where you don't want it to be
- wiseowise 2y ago> Having seen what happens when a React codebase reaches >100k LOC are we really any better off than a class hierarchy? I’m not sure if you correctly understand what functional programming is. Check out Grokking simplicity, great book.
- DeathArrow 2y ago> The OOP model fits nicely into most people’s heads because of the analogy to the real world Nothing in real world resembles OOP.
- freilanzer 2y agoA poodle is a dog is an animal. That's about it, for everything else it's non-intuitive.