Hacker News new | ask | show | jobs
by rhmw2b 2239 days ago
The author points out a poor abstraction and blames the object oriented programming with its secret methods and private code happening behind the scenes, when the issue was just poor documentation or a flawed implementation. Would functional programming really have prevented all bugs?

I've never met someone who hates on OOP like this and has also spent time working in a multi-team setting on a large codebase. Given enough code it's impossible to grok everything that is going on and some kind of abstraction is necessary. This is where OOP really shines; OOP is great exactly because it abstracts away data so I don't have to think about it. Sure, multiple inheritance and deep class ancestry can make OOP code hard to follow, but it's just as easy to write bad code functionally. This post is just comparing the worst of OOP with the best of FP without doing the reverse.

1 comments

Author here. Thanks for reading; I was hoping for interesting criticism like this. I don't think that functional programming would have prevented all bugs, or, for that matter, led to better documentation. And I think you're right, there would have been no problem if the system had been documented carefully. I think my point, which I should have made more clearly, is that object oriented languages encourage this kind of programming, leading to systems that are less transparent, while functional languages tend to result in libraries whose mechanisms are less surprising and easier to understand. But surely you're right, it's possible to write confusing code in a functional style as well. And yes, I have worked with large teams on big programs, but that was numerical code, in fortran or C, with old-school scientist/programmers, so neither object oriented nor functional.