Jump to content

Sports tournament (classes design)


jmberrueta

Recommended Posts

Hi, I am working on some PHP classes (persisted into a MySQL database) to manage a sports tournament, but I have some doubts on how some things should be designed.

 

If I have the following classes:

- Country

- Team

- Cup

- SportsManager

 

One approach I thought of could be that each Cup would have as a member a list of Teams, and it's Country. Then I would provide the SportsManager with getCups(), getCupsByCountry(), etc.

 

This design may be helpfull when using the class, but I don't know if is performant. For example, if I want to list the cups in a menu providing a link to each cup, if I use getCups() the Cup classes would be returned with tons of info I won't need in that particular page, therefore, wasting time querying the database.

 

So... should I pay more attention to easyness of usage or performance? Is there another way of doing such thing without creating methods in the SportsManager such as getCupLinks() or getCupId() and getCupName() to display the menu links without instantiating the whole class?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/64006-sports-tournament-classes-design/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.