Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.