You're asking about a mental image, which is inherently subjective.
You're also conflating two different visualisations. A class is equivalent to a table structure (not data!), and a class instance is equivalent to table data. I think this is leading to you comparing apples and oranges here.
You're very visually inclined here about the tabular example. In practicality, when discussing a table as part of a data design, it is much, much more common to describe its structure using some logical syntax, e.g. CREATE
SQL syntax:
CREATE TABLE table_name (
name varchar(50),
year_founded int,
volunteer_count int
);
Or, if still in the brainstorming stage, a SELECT
statement will allow you to create an example mockup of a (future) table:
SELECT
'My Company' as name,
2005 as year_founded,
123 as volunteer_count
The similarities with your class-based example are striking. Both simply list the available columns/properties and their type (albeit the SELECT
leaving it up to inference more).
And this is for good reason: ORMs specifically exist as an automated mapping between a table row and an object, because from a data perspective they are equivalent structures that can easily be mapped (for common data types).
Working with objects is easier if computed properties are needed as they can easily be added as methods to the object.
The same applies to the SQL examples though.
CREATE TABLE table_name (
name varchar(50), -- real data
name_length AS LEN(name) -- computed data
);
It still contains the same information as you'd see in a class definition.
Working with tables might we faster (in case of Python, the Pandas library can avoid creating costly Python objects and use more low-level datastructures instead.
That's IMO an overoptimization, but if you're that interested in optimizing, why not just directly use your low-level datastructures and use binary serialization to files? It will be significantly faster and not create any padded disk space.
Of course, there are a lot of usability issues with doing so, in terms of debugging or control over the data. And that's the point I'm trying to get to, because that same point applies about using low-level data structures as opposed to proper strongly typed class definitions.
It's not that it can't be done, but it comes at a significant drop in developer comfort.
Also, while I can't speak for Python specifically, in C# there is no significant size difference between an object and a collection of variables containing the same data, as an object is (in memory) merely stored as a collection of its fields. The amount of bits used for data storage is the same, the only difference is stack vs heap.
While there are performance differences here, they are completely negligible in all but the most extreme of cases, and in those extreme cases you will be forced to sacrifice a disproportionately high level of developer comfort to achieve such performance, making it only interesting if your situation really squeezes for performance at the cost of a significantly impacted development time (e.g. embedded software).