|
I largely agree that OOP was a mistake, but I've also worked on very complex procedural code, and it's worse. The abstractions do help. Even something as simple as "this function isn't public so I can safely change it's signature without breaking consumers outside of the class" has HUGE benefits. In something like C, that's not possible. If I change a signature, I have no idea how much stuff I just broke, how large the blast radius is. So, it's more risky. It's a similar thing with interfaces or abstract classes. I need some new functionality. Adding it without an interface is very risky, because I can break a ton of consumers. Or, I can't reuse existing code that we know works, because it's too concrete. Like, maybe I have a function that converts a file to an excel workbook. I built it to read off of disk. But now, I need it to sometimes read from S3. Without interfaces this is very hard. I have to program in new logic to the excel workbook generation function, and I can break it. But if the file reader was an interface, I could just make a new implementation for network attached files. Now, I can re-use all the logic of the excel workbook function and ensure I didn't break it. Yes, there is a problem with poor abstractions. But abstractions, indirection, and de-coupling as a whole is the only reason large codebases can exist. When everything is too everywhere, then changes become too risky, so we just don't make them, and software rots. |