..Studying the Xojo Webinar BaseballLeague project Example.

Hi,
I’m studying the BaseballLeague example project where the database contains two tables called respectively Teams(containing ID, Name, Manager and Location) and Player (containing ID, Name, Position, Age and TeamID
In order to understand better OOP concepts, I wonder if it would have any sense / benefit, to add to the project, two classes, called Teams and Players, replicating the same db structure by adding them as properties and if the case, adding some methods inside.
Best Regards,
thanks for any help in expanding my view.
Antonio

There certainly is benefit in that. It’s called Object-relational mapping and is a common technique to interface object-oriented programming languages to databases.

Thank you very much, Paul. I was, infact, thinking about something more focused on the teams / players entities. I think that following an OOP strategy might give more flexibility, for example, in examining relationships between the various entities belonging to a class and it might be more helpful in case the number of them should increase.

In the case and OOP class version should be implemented, how’d be the best practice strategy in doing it? maybe by creating, at each table’s row read, a new instance of that palyers/teams class with the data returned by the “SELECT * FROM TABLE” statement?

In the ORM frameworks I’ve used and created, I create a new instance of the class for each row in the table.