Multiple implementations of the same back-end application. The aim is to provide quick, side-by-side comparisons of different technologies (languages, frameworks, libraries) while preserving consistent business logic across all implementations.
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.0 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.txt to manage the app and lib subdirectories.
  • Create the lib directory for the static library.
  • Create the app directory for the executable.
  • Configure vcpkg for dependency management and integrate it with CMake.
  • Add a dependency for an HTTP library (e.g., cpp-httplib) via vcpkg.
  • Add a dependency for a testing framework (e.g., catch2) via vcpkg.

Phase 2: Library (lib) - Dummy Implementation

  • Create the directory structure for the library: lib/src, lib/include.
  • Create lib/CMakeLists.txt to build a static library.
  • In lib/include/autostore, define the public interface for the App to use.
  • Create a dummy AutoStore class in lib/include/autostore/AutoStore.h and a source file in lib/src/AutoStore.cpp.
  • Define dummy classes for core domain and application logic inside the library (e.g., ItemRepository, UserService, etc.) to establish the architecture. These will be private to the library initially.

Phase 3: Application (app) - Dummy Implementation

  • Create the directory structure for the application: app/src.
  • Create app/CMakeLists.txt to build the executable.
  • Link the app against the lib static library.
  • Implement the main App class in app/src/App.h and app/src/App.cpp.
  • The App class will have a constructor App(int argc, char** argv) and an exec() method.
  • Implement signal handling (for SIGINT, SIGTERM) in the App class for graceful shutdown.
  • In app/src/Main.cpp, instantiate and run the App class.
  • 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 tests directory.
  • Create tests/CMakeLists.txt to 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 Dockerfile to build the C++ application in a container.
  • Create a docker-compose.yml file to easily build and run the application.