I'm getting confused with (mentally) connecting databases and object-oriented programming.
Imagine a teacher's gradebook application, for example, with a UI displaying students in a table's row and assignments in columns. An underlying database might include a many-to-many relationship: a student has many assignments, and an assignment has many students.
How does the underlying code work? Do you have a Student class with a variable referencing a list of assignments? Or an Assignment class with a variable referencing a list of students? Both? ... Do you have some kind of StudentAssignment class linking instances of Student and Assignment? (And, if so, does that mean a class with 50 students and 10 assignments has 500 StudentAssignment objects, 50 Student objects, and 10 Assignment objects in memory simultaneously?!) ... And then do these various classes consist mostly of (for example) SQL statements working with the underlying database?
I know there's a lot of questions here, but they all kind of go together...what's the generally accepted strategy for coding many-to-many relationships?
p.s. Just so you don't think I'm being lazy, I did look at other questions, like a How to model a Many to many-relationship in code? and Modelling a manyToMany relationship with attributes.