3 ms·
In moderation, yes. The problem with OOP, like all other paradigms that came before, is applying it dogmatically and excessively, which always happens when ther
by userbinator 2y ago
In moderation, yes. The problem with OOP, like all other paradigms that came before, is applying it dogmatically and excessively, which always happens when there's a lot of hype, novelty, and $$$ to be made.
- hk1337 2y agoI agree but "moderation" isn't the best word. OOP is good when used appropriately and not when you fixate that everything has to be within the OOP structure. It's the same thing with languages, IMO. People try to shoehorn tasks into a language when it would be better off in another language.
- loup-vaillant 2y ago> OOP is good when used appropriately What are its appropriate uses? The more I program the fewer I see.
- Instantix 2y agoProjects describing the real world. A car have a motor which have pistons. But can be a mess for inappropriate projects for sure.
- loup-vaillant 2y ago> Projects describing the real world. Yeah, one of the 3 big lies of computer programming: thinking that we should program around a model of the world. We should program around a model of the data that we need to transform to solve whatever problem we need to solve. Even in simulation software like games. A car have a motor which have pistons. But why would I model that? To be honest I’m not sure OOP is appropriate even for CAD software here. Now maybe we could give the user the ability to make a mesh and call that "piston", an let them copy & paste that mesh to build a super-mesh they would call "motor", but this kind of composition is not quite OOP, and the appropriate way to program this stuff is probably not OOP either.
- varelse 2y ago[dead]
- faizshah 2y agoI 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