How nndai/project-oop works
Project Type and Purpose
• This is a console-based full-stack C++ application (“Music Store Management System”) that implements an MVC-like layered architecture.
• Purpose: allow admins and users to manage music items, customers, orders, authentication, and export invoices via a dynamic menu-driven console UI.
File Structure Analysis
• src/ – all C++ source and header files.
• Models: MusicItem, Customer, Order, User
• Managers (business logic): MusicStore, CustomerManager, OrderManager, AuthManager, Database
• Controllers / Actions: classes ending in Action (e.g., AddItemAction, ViewOrdersAction) implement IMenuAction
• Infrastructure: MenuManager, MenuActionFactory, Hasher, TableUI, main.cpp
• database/ – SQL scripts to create and seed MySQL database
• config/ – .env for connection parameters, Doxyfile
• out/ – compiled executables
• test/ – automated unit tests
Key Architectural Insights from README
• MVC flavor:
• Model layer: domain entities (MusicItem, Customer, Order, User)
• View layer: TableUI (console)
• Controller layer: Action classes, MenuManager
• Design patterns:
• Singleton: Database (single connection)
• Factory: MenuActionFactory → IMenuAction
• Dependency Injection: Managers take Database* or other managers in constructor
• SOLID principles strictly applied
Main Components & Relationships
a. Components
1. User Interface (TableUI + MenuManager)
2. Controller Layer (MenuActionFactory + Action classes implementing IMenuAction)
3. Business Logic / Managers (AuthManager, MusicStore, CustomerManager, OrderManager)
4. Data Access Layer (Database singleton)
5. Persistence (MySQL server + database schema defined in SQL files)
b. Interactions
• User selects menu option via MenuManager → MenuActionFactory
• Factory returns an IMenuAction instance → Action::execute()
• Action uses one or more Managers (injected at construction)
• Managers call Database singleton to run SQL queries / transactions
• Results returned → TableUI renders data back to user
• AuthManager and Hasher collaborate for login/register flows
• ExportInvoice writes invoice files based on Order data
c. Architectural Patterns / Principles
• MVC separation (Model, View, Controller)
• Singleton for database connection
• Factory for action instantiation
• DI ensures loose coupling and testability
d. Technologies & Libraries
• C++23, g++ (or MSVC)
• MySQL (connector library)
• Doxygen for documentation
• Unit tests (test_main.cpp)
Additional Details
• Test harness (test_main.cpp) optionally connecting to managers via mock Database or the real one.
• Config/.env feeding parameters into Database initialization.