5 ms·
Why are classes automatically somehow assumed as complex? Rust's structs are basically classes without class inheritance.
by al_mandi 4y ago
Why are classes automatically somehow assumed as complex? Rust's structs are basically classes without class inheritance.
- learn-forever 4y agoDealing with inheritance is pretty complex!
- al_mandi 4y agoRust has traits (similar to interfaces). And limiting to single inheritance like Java/C#/etc. makes things quite manageable.
- zahllos 4y agoThe idea of classes on their own isn't complicated. The problem is that C++ provides an extreme amount of flexibility in how you use them. You can have multiple inheritance. You can have as many levels of partially implemented, partially abstract classes as you like provided you eventually have a concrete class, and these abstract classes can have member data. You can have static methods, which I've seen abused as namespaces so often. You can have static methods and non static ones in a class hierarchy. Finally you can mix templates into this. In an ideal world the developers of a project in a company would collaborate to keep this from getting out of control and enforce a relatively consistent philosophy. However in practice people have their quirks and specific not always rational views, and programmers are in general not always the best at dealing with other people, programmers included. So a strong personality is determined to do it one way and refactors a bunch of code to their liking, and on and on, and now a variety of features have been used in different ways. No language is immune to this as it is fundamentally a human problem, but taking out features generally helps. Since we can get by without inheritance most of the newer languages have done away with it.