3 ms·
Personally, think object oriented programming gets a fair amount "right". That isn't to say there aren't problems. Specifically, classes as a mechanism of pac
by CuriouslyC 11y ago
Personally, think object oriented programming gets a fair amount "right". That isn't to say there aren't problems.
Specifically, classes as a mechanism of packaging data together with all the functions that act on that data is a good idea. Additionally, I think classes are more intuitive and generally tend to be syntactically clearer than their functional equivalent, namespace factories (though less semantically explicit). Fluent style chaining of method invokation is also a lot easier to read than nested function calls in most languages.
The biggest issue I have with classes is the concept of constructors and destructors. These are semantically unclear and basically break multiple inheritance. Aside from that, in dynamic languages classes also encourage people to write code that checks class type, which is both brittle and potentially limiting, depending on the context.