How datpham0412/cgpa-calculator works
Project Type and Purpose
• This is a terminal-based CGPA Calculator written in C++.
• It uses SQLite (via the external SQLiteCpp library) to manage database interactions.
• The application is designed using object-oriented principles, and its functionality centers on managing student details, courses, and grade calculations.
• The inclusion of unit tests (using Google Test) indicates that testing is also a critical part of the system.
File Structure
• Top-level items include configuration files (e.g., CMakeLists.txt, .gitignore, .gitmodules) and essential documentation (README.md, LICENSE).
• The “include” directory contains header files (Course, Database, Menu, Student, StudentOperations) that define the core interfaces/classes.
• The “src” directory contains the corresponding implementation (.cpp) files including main.cpp, which acts as the entry point.
• The “external” directory holds the SQLiteCpp third-party library, a key component for database management.
• The “test” directory contains unit tests for validating various pieces of functionality (e.g., tests for Course, Student, and the main functionality).
Main Components and Their Relationships
a. Application Entry Point:
• The main function (in main.cpp) initializes the system and orchestrates the flow.
b. User Interface (UI):
• The Menu component provides the terminal-based interface for user interaction.
c. Domain/Business Logic:
• Student, Course, and StudentOperations represent the core entities and operations.
• The application logic calculates GPA/CGPA and manages student/course records.
d. Data Persistence:
• The Database component handles all interactions with the SQLite database using the SQLiteCpp library.
e. External Libraries and Dependencies:
• SQLiteCpp (under “external”) is used to encapsulate the database operations.
f. Testing:
• Separate unit test components (under “test”) ensure the integrity of core logic.
Diagramming the System Architecture
• “Student”, “Course”, and “StudentOperations” which contain the core business logic.
• Optionally, include a separate section or note that points to “Google Test” for unit testing, indicating that tests are performed on key components.
Architectural Patterns and Technologies
• Separation of concerns: The UI (Menu) is distinct from the core business logic (Student, Course, StudentOperations) and the data access layer (Database).
• That object-oriented programming principles are prevalent; each domain element (student, course, etc.) encapsulates its behavior.
• That CMake is being used for managing builds, and although not directly part of the runtime architecture, it is critical for setting up the development environment.
• That the project is designed for cross-platform terminal operations.