In Learning SQL the Hard Way, the author says:
OOP languages are organized around graphs, but SQL wants to only return tables
What does it mean for an OOP language to be organized around a graph? Does this refer to data being stored in specific memory addresses?
As Nick.McDermaid comments above, the relevant sense of graph is the abstract data type.
In an object-oriented language, the "object graph" consists of objects and the "has-a" relationships between them. For example, a Person
object might have a field of type Collection<Address>
, in which case the object graph would include the relationship from the person to all of his/her addresses.
The sentence immediately following your quotation is, "If SQL returned a nested data structure then this wouldn't be a problem." If you select from a PERSON
table, you will not automatically get all of the corresponding rows from ADDRESS
. You can do a JOIN
, of course, but then the result-set will include one copy of the PERSON
row for each of its corresponding ADDRESS
rows. So you have to do some translation work, after getting your query results, to create the object graph that you would like to work with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With