Developing a Hockey Team Manager platform using Object-Oriented Programming

Ever wanted a simple platform to contain the information of all participating teams in a sports league, including the information pertaining to their teams? In this project, I demonstrate my understanding of the underlying concepts of object-oriented programming (OOP) to develop a platform for the storage and management of information relating to school teams in a youth hockey league. The program itself does not do much as it is more of a demonstration of what can be achieved through OOP in Python. The purpose of this project was also for me to demonstrate what I am able to do when it comes to the deployment and maintenance of custom-built data platforms and algorithms. This post contains information on the purpose of the program, its main components, and their functions, as well as a detailed user guide. I have also included the code which makes up the two files comprising the program, for anyone wishing to download and run it.

1. Introduction

The purpose of the program is to provide a platform for the management and administration of hockey teams in a youth hockey league. The program could be useful for the administrators of the hockey league who would want to keep all important information regarding the teams in one easily accessible and easy to manipulate platform.

While the program itself does not keep track of scores and leaderboards, it has the functionality that can allow the league administrators to lookup team information, update information about teams, add new teams, and delete teams as may be required. Development of the program was conducted using the Python programming language, and its execution at this time is only possible in the Python shell using any of the IDEs available.

Two classes make up the program, the “Team” class, and the “HockeyTeamManager” class. The following section contains a description of what the classes do, as well as how they are used to execute the programme. The last section of this report contains a user guide providing key instructions on how one can run the program.

2.     Description of the programme

As stated in the introduction, the programme is made up of two classes, the Team class and the HockeyTeamManager class (going forward referred to as the user interface class). These classes are contained in two separate .py files, with the Team setting the environment for the program’s functionality while the user interface contains a set of methods that call the functions set in the Team class, adding all functionality that the program should have. Below is a further breakdown of the detail and functions of each class.

2.1.   The “Team” class

The purpose of the Team class is to represent a hockey team in a youth hockey league. It has private class fields for the team’s ID, creation date, name, type (boys/girls), fee paid, fee required, and cancellation date. It has a constructor that initializes these fields when a new team is created. It also has getter and setter methods for each field, as well as a __str__ method that returns a string representation of the team.

The Team class is a critical component of the program because it represents the teams that the user is working with. Without the Team class, it would be impossible for the user interface to display any information about the teams or allow the user to interact with the team’s data. The Team class is responsible for storing and managing the data related to a teams, such as the teams’ name, type, and payment information. This data is essential for the user interface to display accurate and up-to-date information about the teams.

2.2.   The “HockeyTeamManager” class

The HockeyTeamManager class collaborates with the Team class by creating new Team objects when the user selects the option to create a new team. It also reads, updates, and deletes existing Team objects from the list of teams by calling methods created in the Team class.

This class is made up of eight methods, each with a specific function in the program corresponding to the menu items 1 – 8:

  • The print_menu method displays the available options to the user.
  • The create_team method prompts the user to input the team’s name, type, fee paid status, and fee amount paid, creates a new Team object with these values, and adds it to the list of teams.
  • The read_team, read_boys_teams, read_girls_teams, and read_all_teams methods display information about existing teams based on the user’s selection.
  • The update_team method prompts the user to input new values for a specific team’s name, type, fee paid status, and fee amount paid, and updates the corresponding Team object with these new values.
  • The delete_team method prompts the user to input a team ID and removes the corresponding Team object from the list of teams.

3.     Program user guide

The program is fairly easy to use, once you click “run”, you will find that the program kind of guides you along the way, and your role will be to tell it what you want to do and enter information it requests through the prompts. Here is how to use the program:

3.1.   Downloading and running the program
  1. Save the two files: team.py and user_interface.py to a folder on your computer.
  2. Navigate to the folder where the files are saved. #NB it is essential that both files be saved in the same folder before they are opened.
    • Please note that in the event that you do not have python and any IDE installed on your computer, you will need to begin by installing these, then come back to continue with step 2.
  3. Load the file onto your IDE program/ double click on the user_interface.py file to open it with the default IDE installed on your pc.
  4. Run the user_interface.py file by clicking the “run” button on your IDE or use any keyboard shortcuts that allow you to run the program in your IDE.
3.2.   Using the program
  1. The program will display a menu of options to choose from:
  • Create a new team: Allows you to add a new team to the database. You will be prompted to enter a team’s name, type (girls/boys), fee paid (y/n), and fee amount (exact amount paid (maximum 1000).
  • Read Teams: Menu items 2, 3, 4, and 5 allow you to view the teams in the database based on your selection. “Read a specific team” allows you to see all the information pertaining to a team whose team id you enter, while “Read all boys’ teams” lists all the teams saved in the database where team type = boys, the “Read all girls’ teams”  lists all the teams saved in the database where team type = boys, and “Read all teams” displays the information on all teams entered in the database regardless of their type.
  • Update Team: Allows you to update the information of an existing team in the database. You will be prompted to enter the ID of the team you want to update, and then you can update the team name, type, fee status, and fee paid.
  • Delete Team: Allows you to delete a team from the database. You will be prompted to first enter the ID of the team you want to delete.
  • Exit: Allows you to exit the program.

6. To select an option, enter the corresponding number and press enter.

7. If you selected “Add Team”, follow the prompts to enter the team’s information. #NB: Entering the wrong team type (neither boys nor girls) causes the program to display an error message, and you will have to re-enter the team’s information again.

8. If you selected “View Teams”, a list with all/ a selection of the teams in the database will be displayed.

9. If you selected “Update Team”, follow the prompts to enter the ID of the team you want to update, and then the information you want to change.

10. If you selected “Delete Team”, follow the prompts to enter the ID of the team you want to delete.

11. After completing any action, the program will return you to the main menu where you can select another option or choose to exit the program.

#NB: To get the best out of the program, it’s better if you begin by adding the details of one or two teams, then use the details of the team(s) entered to check the other functions that come with the program.

That’s it! With this user guide, you should be able to navigate the program and perform all the necessary actions to manage your youth league teams database. All the best!

View the user interface below
View the team file below