You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.1 KiB
3.1 KiB
C++17 AutoStore Implementation Plan
This document outlines the steps to implement the C++17 version of the AutoStore application. Implemented classes should use nxl:: namespace prefix.
Phase 1: Project Scaffolding & Build System
- Initialize a CMake project structure.
- Set up the root
CMakeLists.txtto manage theappandlibsubdirectories. - Create the
libdirectory for the static library. - Create the
appdirectory for the executable. - Configure
vcpkgfor dependency management and integrate it with CMake. - Add a dependency for an HTTP library (e.g.,
cpp-httplib) viavcpkg. - Add a dependency for a testing framework (e.g.,
catch2) viavcpkg.
Phase 2: Library (lib) - Dummy Implementation
- Create the directory structure for the library:
lib/src,lib/include. - Create
lib/CMakeLists.txtto build a static library. - In
lib/include/autostore, define the public interface for theAppto use. - Create a dummy
AutoStoreclass inlib/include/autostore/AutoStore.hand a source file inlib/src/AutoStore.cpp. - Define initail classes for core domain and application logic inside the library (e.g.,
ItemRepository,UserService, etc.) to establish the architecture. These will be mostly private to the library initially and implemented later. - Ensure the project compiles and links successfully with the dummy implementations.
Phase 3: Application (app) - Dummy Implementation
- Create the directory structure for the application:
app/src. - Create
app/CMakeLists.txtto build the executable. - Link the
appagainst thelibstatic library. - Implement the main
Appclass inapp/src/App.handapp/src/App.cpp. - The
Appclass will have a constructorApp(int argc, char** argv)and anexec()method. - Implement signal handling (for
SIGINT,SIGTERM) in theAppclass for graceful shutdown. - In
app/src/Main.cpp, instantiate and run theAppclass. - Ensure the project compiles and links successfully with the dummy implementations.
Phase 4: Core Logic Implementation
- Implement the Domain layer in
lib/src/domain. - Implement the Application layer in
lib/src/application. - Implement the Infrastructure layer in
lib/src/infrastructure(e.g., file-based persistence, HTTP client for ordering). - Implement the Presentation layer (HTTP API) using the chosen HTTP library.
- Implement the startup logic to check for expired items.
- Implement a background mechanism (e.g., a thread) to periodically check for expired items.
Phase 5: Testing
- Set up a
testsdirectory. - Create
tests/CMakeLists.txtto build the test runner. - Write unit tests for the Domain layer.
- Write unit tests for the Application layer, using mocks for infrastructure interfaces.
- Write integration tests for the Infrastructure layer.
Phase 6: Containerization
- Create a
Dockerfileto build the C++ application in a container. - Create a
docker-compose.ymlfile to easily build and run the application.