How mensiomar/application-de-gestion-de-stock works
Project type and purpose
• This is a standalone, monolithic C console application (“Stock-Manager”) designed to manage product inventory and keep an archive of daily and monthly stock movements.
• It provides a command‐line interface to add, view, modify, delete, and search products, and logs each operation into text files.
File structure
• principal.c: entry point, main loop, CLI menu, dispatches user commands.
• functions.c: implements the core operations (add, delete, modify, search, list, history).
• struct.h: defines the C structs representing a product record and a history record.
• stock.txt: persistent storage for current inventory records.
• historique.txt: persistent storage for chronological logs of stock movements.
• Other files are documentation and design sketches.
README for additional insights
• Project is decomposed into four logical parts: data storage, data structures, functions/procedures, and presentation (design of the interface).
• Emphasis on using file I/O (rename, remove) and simple text storage.
a. Main components
• Presentation Layer (CLI)
• Business Logic Layer (Functions/Procedures)
• Data Layer (File Storage)
• Data Model (C Structs)
b. Relationships & interactions
• User → CLI Menu (principal.c)
• CLI Menu → Business Logic Calls (functions.c)
• Business Logic → Data Model (load into memory, manipulate structs)
• Business Logic → File I/O (read/write/rename/remove stock.txt and historique.txt)
c. Architectural patterns & principles
• Layered/Modular: clear separation between presentation, logic, and persistence.
• Single executable, procedural modules.
• Stateless operations: each command loads data, processes, then writes back.
d. Key technologies
• C language, standard library for file I/O (fopen, fprintf, fscanf, rename, remove)
• Text files for persistent storage
• Simple build via gcc
Detail
• Module with its source file (e.g., Stock Operations Module [functions.c]).
• Edge cases (e.g., file rename/remove operations when deleting a record).
• Sequence: upon “delete product,” Business Logic reads stock.txt → removes entry → writes to temp file → renames temp → logs action to historique.txt.