upvote
Promoting the idea of one data structure with many functions contradicts:

“If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident.”

And:

“Use simple algorithms as well as simple data structures.”

A data structure general enough to solve enough problems to be meaningful will either be poorly suited to some problems or have complex algorithms for those problems, or both.

There are reasons we don’t all use graph databases or triple stores, and rely on abstractions over our byte arrays.

reply
I think you are badly misinterpreting the statement.

Let's say you're working for the DMV on a program for driver's licenses. The idea is to use one structure for driver's license data, as opposed to using one structure for new driver's licenses, a different one for renewals, and yet a third for expired ones, and a fourth one for name changes.

It is not saying that you should use byte arrays for driver's license records, so that you can use the same data structure for driver's license data and missile tracks. Generalize within your program, not across all possible programs running on all computers.

reply
Your admittedly exaggerated example is arguing against the entire concept of relational databases, which is not a winning proposition.

You do not write programs with one map of id to thing as you are suggesting here.

reply