jmberrueta Posted August 9, 2007 Share Posted August 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/64006-sports-tournament-classes-design/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.