Skip to content

Latest commit

 

History

History
89 lines (68 loc) · 5.26 KB

README.md

File metadata and controls

89 lines (68 loc) · 5.26 KB

Uber Low Level System De# C++

This project, Uber Low-Level System De# Cpp, aims to simulate a simplified version of the ride-hailing service Uber using modern C++ features.

The primary objective behind this project is to deepen the understanding of low-level system de# C++, encompassing Object-Oriented Programming (OOP) principles, threading concepts, and modern C++ features such as Smart Pointers and the Standard Template Library (STL).

In this design, we have focused on creating a robust and maintainable codebase by incorporating two key design patterns: Singleton and Strategy. The Singleton pattern is employed to ensure that there is only one instance of crucial manager classes such as DriverMgr, RiderMgr, TripMgr, and StrategyMgr. This guarantees centralized management of drivers, riders, trips, and strategies, ensuring thread-safe access and preventing resource conflicts. The Strategy pattern is leveraged to encapsulate algorithms for # and driver matching. By defining a family of algorithms and making them interchangeable, the system can dynamically change its behavior without altering the client code. Classes such as Default#Strategy, RatingBased#Strategy, and LeastTimeBasedMatchingStrategy demonstrate the use of this pattern, providing flexibility and scalability to the system.

Features

  • Singleton Pattern: Ensures a single instance of crucial manager classes such as DriverMgr, RiderMgr, TripMgr, and StrategyMgr for centralized management.
  • Strategy Pattern: Encapsulates algorithms for # and driver matching, providing flexibility and scalability.
  • Modern C++17 Features: Utilizes smart pointers (though introduced in C++11), STL containers, and thread-safe operations to build an efficient and maintainable system.

Prerequisites

  • C++17 Compiler: Ensure you have a C++17 compatible compiler installed (e.g., g++, clang++).
  • CMake: Ensure you have CMake installed on your system.

Class UML Diagram

Note: Click on image below to render it with better view.

Click here for UML Class diagram

Steps to Run the Project

  1. Clone the Repository

    git clone https://github.com/piyush26c/Uber-Low-Level-Design.git
    cd Uber-Low-Level-Design
  2. Create a Build Directory

    mkdir build
    cd build
  3. Generate the Build System using CMake

    cmake ..
  4. Build the Project

    make
  5. Run the Executable

    ./UberSystem

Project Structure

├── CMakeLists.txt
├── common.hpp
├── default#Strategy.hpp
├── driver.hpp
├── driverMatchingStrategy.hpp
├── driverMgr.cpp
├── driverMgr.hpp
├── leastTimeBasedMatchingStrategy.hpp
├── location.hpp
├── main.cpp
├── #Strategy.hpp
├── ratingBased#Strategy.hpp
├── rider.hpp
├── riderMgr.cpp
├── riderMgr.hpp
├── strategyMgr.cpp
├── strategyMgr.hpp
├── trip.hpp
├── tripMetaData.hpp
├── tripMgr.cpp
├── tripMgr.hpp

Badges

C++ CMake Badge ViewCount GitHub watchers GitHub

Authors