How dhruvreddys/quizmaster works
Project Type and Purpose
• The README indicates that QuizMaster is part of an IITM BS DEGREE MAD1 PROJECT. Based on the file structure, QuizMaster is a web application that appears to manage quiz-related functionality (creating quizzes, adding questions, handling user attempts, etc.).
• The project uses HTML templates and CSS files for the front-end, Python code for the backend, and SQLite (quizmaster.sqlite3) as its database.
Analyzing the File Structure
• Main Entry Point: The app.py file serves as the starting point of the application.
• Controllers Directory: Contains controller.py and studentcontroller.py which likely implement the application logic for handling incoming requests, routing, and possibly business rules.
• Models Directory: Contains database.py. This module probably encapsulates interactions with the SQLite database, representing the data layer.
• Instance Directory: Houses the actual SQLite database file, which indicates persistence for user data, questions, quizzes, etc.
• Templates Directory: Contains HTML files that define the user interface pages. There are multiple pages for registration, dashboards, quiz forms, results, etc.
• Static Directory: Contains CSS files (and a charts subdirectory), which are used for styling the front-end.
• Additional files: requirements.txt specifies dependencies. The DEPLOY directory bundles the components for deployment.
Key Architectural Components
a. Web Client (Browser):
• Represents the end-users accessing the application via HTML pages.
b. Frontend Components:
• Templates: Jinja2 templates that generate dynamic HTML.
• Static Files: CSS, and possibly JavaScript (if it were present), used to style and add interactivity to the pages.
c. Application Server:
• The main app.py which initializes the Flask application and sets up routing.
• Controllers: The controller modules (controller.py, studentcontroller.py) to handle HTTP requests, implement business logic, and route responses.
d. Data Models and Persistence Layer:
• Models (database.py) that interact with the SQLite database.
• SQLite Database: The instance/quizmaster.sqlite3 file that stores persistent application data.
e. External Dependencies:
• Python Packages specified in requirements.txt (e.g., Flask and other dependencies) that support the application's functionality.
Relationships and Interactions
• Inside the Application Server, indicate that app.py routes these requests to an appropriate Controller.
• Controllers then process the request, interacting with the Models to either fetch or modify data.
• The Models (database.py) communicate with the SQLite Database to perform CRUD operations.
• The Controller then renders an appropriate Template (from the Templates folder), incorporating data retrieved from the Models, and sends the rendered HTML back to the Web Client.
• A feedback loop for user interactions (e.g., form submissions, Quiz attempts) should be visually depicted.
Architectural Patterns and Design Principles
• MVC-Like Separation: The structure follows an MVC (Model-View-Controller) paradigm. Models handle data, the Templates (View) handle presentation, and the Controllers manage the business logic and request routing.
• Layered Architecture: There is a clear separation between presentation (templates, static assets), business logic (controllers), and data access (models and database).
• Modularity: Using separate directories for controllers, models, and templates increases maintainability and testability.