Main Application Class¶
Application Runtime Core
The command-loop engine that initializes data, authenticates users, and routes role workflows.
The SchoolCourseEnrolmentSystem class serves as the main entry point of the School Enrollment System.
It coordinates authentication, role selection, workflow execution, and data persistence.
Purpose¶
The purpose of the main application class is to:
- Initialize the system and load all saved data
- Create and register a default administrator
- Provide the main role selection loop
- Authenticate users based on their selected role
- Direct users to their respective workflows
- Save data before exiting the program
This class acts as the central controller of the entire application.
Structure and key components¶
1. Default administrator instance¶
The system creates a default administrator at startup:
- Ensures that administrative tasks are always possible
- Prevents the system from starting without an admin
- Allows immediate access to user and course management features
This administrator is added to the system even if data is loaded from files.
2. Main method flow¶
The main method performs the following steps:
- Initializes the singleton
dataManagerinstance - Loads all previously saved data using
loadAllData() - Adds the default administrator to the system
- Enters the main role selection loop
- Saves all data before exiting
This ensures that the system state is preserved across sessions.
3. Role selection loop¶
The program repeatedly prompts the user to select a role:
- Student
- Instructor
- Administrator
- Exit
Based on the selected role, the system:
- Authenticates the user using the generic login system in
Helpers - Directs the user to the appropriate workflow
- Handles logout and returns to the main menu
This loop continues until the user chooses to exit.
Student workflow¶
After successful login, students can:
- View available courses
- Enroll in a course
- View enrolled courses
- View credit limit
- Drop a course
- View grades
- Update personal profile
- Logout
Certain actions (such as updating personal information) trigger immediate data saving.
Instructor workflow¶
After successful login, instructors can:
- View enrolled students in their assigned courses
- Grade students
- Update course information
- Update personal profile
- Logout
These actions allow instructors to manage academic responsibilities.
Administrator workflow¶
After successful login, administrators can:
- Add students
- Remove students
- View student list
- Add instructors
- Remove instructors
- View instructor list
- Add courses
- Close courses
- Update student information
- Update instructor information
- Assign instructors to courses
- View enrollment statistics
- Generate reports
- Logout
Administrators have full control over system data and structure.
Exit flow¶
When the user selects "exit":
- The system saves all data using
dataManager - A final message is displayed
- The program terminates cleanly
This ensures that no data is lost between sessions.
Exception handling¶
The main class includes basic exception handling to:
- Prevent crashes from invalid input
- Ensure the main loop continues running
- Provide clear feedback to the user
Most validation and safety checks are delegated to the Helpers class.
Summary¶
The SchoolCourseEnrolmentSystem class orchestrates the entire application.
By managing initialization, authentication, workflows, and data persistence, it ensures that the system operates smoothly and consistently.
This class ties together all components of the School Enrollment System.