Analogy between OOP and database

3

I've been reading about the Entity Framework, which has the capabilities to turn classes into tables and objects into rows. I found it super interesting!

To what extent is this analogy valid? If so, then what would be the analog of an interface in BD?

And what would be, in OOP, the analogue of a bridge table?

Does it make sense to extend this analogy, or not?

    
asked by anonymous 31.07.2018 / 06:22

1 answer

3
  

If so, then what would be the analog of an interface in BD?

Nothing.

  

And what would be, in OOP, the analogue of a bridge table?

There's nothing special about it. The maximum that can occur, but usually not quite so, is that an array is used to make the connection between the tables that relate.

  

Does it make sense to extend this analogy, or not?

No, nothing to see.

The only thing that EF does is to get the fields of the classes with their attributes and create a table in the database data according to this specification, nothing more.

It operates essentially in anemic models. Not that it can not have behaviors in the class, but they will be ignored when it transposes to the database.

    
31.07.2018 / 06:37