# ahmedelbaramony/student-managment-system architecture

> Architecture diagram of the GitHub repository ahmedelbaramony/student-managment-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmedelbaramony/student-managment-system
- Repository: https://github.com/ahmedelbaramony/student-managment-system

## Overview

##### Project type and purpose
- This is a desktop-only, monolithic “Student Management System” written in C++/Qt.
- It provides a GUI for managing students, subjects, grades, and computing statistics (GPA, mean, median, mode, standard deviation).

##### File structure
- Top-level directory “StudentGradeChecker” contains:
- CMakeLists.txt (build configuration)
- main.cpp + mainwindow.* (application entry point and main UI)
- addstudent.*, removestudent.*, searchstudent.*, registersubjects.*, removesubject.*, subjectcalculations.* (individual dialog modules)
- classes.cpp/h (domain models for Student, Subject, Enrollment)
- Debug build subdirectory holds CMake/Ninja artifacts, generated MOC code, and two flat text files (students.txt, subjects.txt) used for persistence.

##### Extract architectural insights from the README
- Qt GUI for user interaction.
- Business rules around subject and student management are handled in C++ classes.
- Persistence via plain text files.

##### Main components
a. Presentation Layer (Qt UI)
­– MainWindow
­– Dialog modules: AddStudentDialog, RemoveStudentDialog, SearchStudentDialog, RegisterSubjectsDialog, RemoveSubjectDialog, SubjectCalculationsDialog
b. Domain Layer (Business Logic)
­– classes.cpp/h: StudentManager, SubjectManager, EnrollmentManager
­– subjectcalculations.cpp/h: StatisticsCalculator
c. Data Layer (Persistence)
­– FileStorage: students.txt, subjects.txt reader/writer
d. Build & Generation (auxiliary)
­– CMake (CMakeLists.txt) + Qt MOC (auto-gen code)

##### Relationships & data flows
- UI components invoke Domain Layer APIs to: add/edit/remove entities or compute statistics.
- Domain Layer calls FileStorage to load/save data.
- FileStorage reads/writes the text files on disk.
- At startup MainWindow → DomainLayer.loadAll() → FileStorage.readFiles().
- On dialog “OK” → DomainLayer.updateXXX() → FileStorage.writeFiles() → UI refresh.

##### Architectural patterns & design principles
- Layered (Presentation → Business → Persistence)
- MVC/MVP flavor:
­– View = Qt UI classes
­– Model = classes.cpp/h (Student/Subject objects + collections)
­– Controller = mainwindow.cpp and dialog controllers
- Single responsibility: each dialog/module handles one use case.
- Plain-text file storage (no DB), so persistence is simple sequential I/O.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Presentation Layer"
        MW["MainWindow"]:::presentation
        ASD["AddStudentDialog"]:::presentation
        RSD["RemoveStudentDialog"]:::presentation
        SSD["SearchStudentDialog"]:::presentation
        RgSD["RegisterSubjectsDialog"]:::presentation
        RmSD["RemoveSubjectDialog"]:::presentation
        SCD["SubjectCalculationsDialog"]:::presentation
    end

    subgraph "Domain Layer"
        SM["StudentManager"]:::domain
        SuM["SubjectManager"]:::domain
        EM["EnrollmentManager"]:::domain
        SC["StatisticsCalculator"]:::domain
    end

    subgraph "Persistence Layer"
        FS["FileStorage"]:::persistence
        ST["students.txt"]:::persistence
        SB["subjects.txt"]:::persistence
    end

    subgraph "Build & Generation"
        CMake["CMakeLists.txt"]:::build
        MOC["MOC Auto-generated"]:::build
    end

    %% Presentation to Domain calls
    MW -->|"loadData()"| SM
    ASD -->|"updateStudent()"| SM
    RSD -->|"updateStudent()"| SM
    SSD -->|"queryStudent()"| SM
    RgSD -->|"registerSubject()"| SuM
    RmSD -->|"removeSubject()"| SuM
    SCD -->|"computeStatistics()"| SC

    %% Domain to Persistence I/O
    SM -->|"saveData()"| FS
    SuM -->|"saveData()"| FS
    EM -->|"saveData()"| FS
    SC -->|"loadData()"| FS

    %% FileStorage to files
    FS -->|"read/write"| ST
    FS -->|"read/write"| SB

    %% Persistence back to Domain
    FS -->|"dataLoaded()"| SM

    %% Build relationships
    CMake -->|"configures"| MOC

    %% Click Events
    click MW "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/mainwindow.cpp"
    click ASD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/addstudent.cpp"
    click RSD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/removestudent.cpp"
    click SSD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/searchstudent.cpp"
    click RgSD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/registersubjects.cpp"
    click RmSD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/removesubject.cpp"
    click SCD "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/subjectcalculations.cpp"
    click SM "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/classes.cpp"
    click SC "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/subjectcalculations.cpp"
    click FS "https://github.com/ahmedelbaramony/student-managment-system/tree/master/build-StudentGradeChecker-Desktop_Qt_6_6_1_MinGW_64_bit-Debug"
    click ST "https://github.com/ahmedelbaramony/student-managment-system/blob/master/build-StudentGradeChecker-Desktop_Qt_6_6_1_MinGW_64_bit-Debug/students.txt"
    click SB "https://github.com/ahmedelbaramony/student-managment-system/blob/master/build-StudentGradeChecker-Desktop_Qt_6_6_1_MinGW_64_bit-Debug/subjects.txt"
    click CMake "https://github.com/ahmedelbaramony/student-managment-system/blob/master/StudentGradeChecker/CMakeLists.txt"
    click MOC "https://github.com/ahmedelbaramony/student-managment-system/tree/master/build-StudentGradeChecker-Desktop_Qt_6_6_1_MinGW_64_bit-Debug/StudentGradeChecker_autogen"

    %% Styles
    classDef presentation fill:#add8e6,stroke:#000,color:#000;
    classDef domain fill:#90ee90,stroke:#000,color:#000;
    classDef persistence fill:#fdfd96,stroke:#000,color:#000;
    classDef build fill:#d3d3d3,stroke:#000,color:#000;
```
