3 ms·
"Object-oriented languages, Liskov said, tend to conflate the concrete representation of a type with the interface used to access it." This is why I prefer C t
by gprisament 17y ago
"Object-oriented languages, Liskov said, tend to conflate the concrete representation of a type with the interface used to access it."
This is why I prefer C to C++. An opaque data type in C has a clean separation of the interface from the implementation. C++ classes tend to have both methods and implementation-dependent data specified in a single file. Granted, one can write good or bad code in any language, but I've found C encourages good behavior in this regard more than C++.
- derefr 17y agoI really wish people could just abstain from using the built-in class abstractions in their C++, instead of switching wholesale to C and losing all of C++'s other niceties (templates, exceptions, less cruft on portability of primitives, etc.) C++-without-classes is a really nice medium-level language, one that's a lot better at being C than C is, and it'd be nice if more things could be written in it. It would be perfect for the Linux kernel and GNOME, for example. However, as you've said, C++ encourages you to use its badly-thought-out class abstractions, and that's what most people who "code C++" tend to know how to do. Linus, I believe, disallowed C++ specifically because people would gradually write the kernel into a maintainability corner, by modeling things as hierarchies of classes without understanding the implications.