> Classes make functions visible while keeping data implied. Data structures make data visible while keeping functions implied.
> Classes make it easy to add types but hard to add functions. Data structures make it easy to add functions but hard to add types.
> Data Structures expose callers to recompilation and redeployment. Classes isolate callers from recompilation and redeployment.
is only somewhat true. I suspect it would be more accurate to say that it's a matter of indirection: static dispatch isolates callers from recompilation; static dispatch exposes callers to recompilation; calling a function pointer isolates callers from recompilation; calling a function directly exposes callers to recompilation. (All of this in statically typed languages.) Though this isn't my area of expertise. Perhaps someone else knows more? [Edit: sounds like these "expose" cases often don't cause recompilation either.]
Regarding the claim ...
> Data Structures expose callers to recompilation and redeployment. Classes isolate callers from recompilation and redeployment.
... most projects (maybe all?) I've worked on in 20+ years deployed a full set of new bits upon release, rather than trying to differentiate at the level of which source code files were and were not touched.
So this strikes me as a carryover from many years ago when working on large C++ projects with slow compile times was even more painful than it is today.
Consider any scenario in which you don't control all of the source code that gets run. For example, software which supports 3rd party plugins, Apple releasing a new version of iOS, etc.
> C++ is still painfully slow to compile, and seems to get slower every year.
oh come on. I can get a full build of qt5's main libraries (core, gui, widgets, network, xml, etc) in 15 minutes on my laptop. It took an hour a few years ago. Compilers are getting faster all the time.
While it still is definitely worse than other compiled languages, using pre-compiled headers, with incremental compilation, incremental linking does help a lot.
And making use of binary libraries as well.
Eventually with C++20 modules the situation will improve, and maybe by 2025, those that still care might finally enjoy Delphi compile times with C++.
> Classes make functions visible while keeping data implied. Data structures make data visible while keeping functions implied. > Classes make it easy to add types but hard to add functions. Data structures make it easy to add functions but hard to add types.
is known as the Expression Problem https://en.wikipedia.org/wiki/Expression_problem.
The last point:
> Data Structures expose callers to recompilation and redeployment. Classes isolate callers from recompilation and redeployment.
is only somewhat true. I suspect it would be more accurate to say that it's a matter of indirection: static dispatch isolates callers from recompilation; static dispatch exposes callers to recompilation; calling a function pointer isolates callers from recompilation; calling a function directly exposes callers to recompilation. (All of this in statically typed languages.) Though this isn't my area of expertise. Perhaps someone else knows more? [Edit: sounds like these "expose" cases often don't cause recompilation either.]