3 ms·
The difference between them is probably that the OOP was a solution to all problems in its heyday. And a lot of us are probably saddled with the resulting legac
by boardwaalk 7y ago
The difference between them is probably that the OOP was a solution to all problems in its heyday. And a lot of us are probably saddled with the resulting legacy code to this day.
That never quite happened to functional code and procedural code was the only solution to problems at the time.
- AnimalMuppet 7y agoIn my opinion, C++-style OOP was a solution to a particular problem: Here's a procedural program. It's got some data. That data is grouped together for convenience in, say, C-style structs. The problem is that any function in the entire program can modify the data in the structs. When the data goes bad (self-inconsistent, say), that gives you a lot of places to look. Someone wrote a function that doesn't maintain the data in a consistent state, and it could be anywhere. In a 10-million-line code base, that could be a long search. C++ classes changed that. Nobody gets to modify the data except member functions (presuming no inheritance). Maintaining the consistency of the data is easier, because there's a very limited number of functions to look at to make sure they preserve the invariants. With inheritance, you can still do that for the parts that you make private. Now, is that the ultimate answer to how to do software development? Perhaps not. It was a step better than the way things were before, though.