How andry018/car_sharing works
Project Type and Purpose
• This is a monolithic, command-line “full-stack” application (no network) for managing users, vehicles, bookings, time slots and tariffs entirely in C.
• Persistence is file-based; roles (admin / standard user) drive access to features.
File Structure
• Top-level directories:
– /src: C modules (business logic, interface & data access)
– /data: plain-text persistence files (utenti.txt, veicoli.txt, prenotazioni.txt, fasceorarie.txt)
– /docs: user/technical guides, API descriptions, project structure docs
• Key modules in /src:
– main.c → Menu / Interface Layer
– utenti.{c,h} → User Manager + Hash Table ADT
– vehicle.{c,h} → Vehicle Manager + Linked-List ADT
– prenotazioni.{c,h} → Booking Manager + Priority Queue (Binary Heap)
– fasceorarie.{c,h} → Time-Slot / Availability Manager
– tariffe.{c,h} → Tariff Manager
– data_sistema.{c,h} → Data-Access Layer (file I/O)
– hash.{c,h} → Hash Table implementation
README for Architecture Insights
• The README (and docs) already outline a 3-layer architecture:
Interface → Business Logic → Data Access → File System
• It details the use of specific ADTs (heap, linked list, hash table) and describes module interactions (e.g., Booking Manager calls Vehicle Manager, then writes to file).
Main Components & Their Interactions
a. Components:
1. Interface Layer
• Menu System (main.c)
2. Business Logic Layer
• User Manager (utenti)
• Vehicle Manager (vehicle)
• Booking Manager (prenotazioni)
• Time-Slot Manager (fasceorarie)
• Tariff Manager (tariffe)
3. Data Access Layer
• File Operations / Persistence (data_sistema)
• Input Validation & Error Handling
4. File System
• Data files in /data
• Backup & file locking
b. Interactions:
• UI → calls Business Logic APIs
• Booking Manager ↔ Vehicle Manager (check availability)
• Booking Manager → Data Access (save booking)
• User Manager ↔ Hash ADT for login/registration
• Vehicle Manager ↔ List ADT for add/remove vehicles
• Data Access → File System (reads/writes .txt)
c. Architectural Patterns:
• Layered architecture (clear separation)
• Modular C with well-defined ADTs: priority queue, linked list, hash table
• Single-threaded; file locking for atomic I/O
• Menu-driven CLI
d. Technologies & Frameworks:
• C (GCC / MinGW)
• Makefile build system
• Standard C file I/O