Skip to content

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

Notifications You must be signed in to change notification settings

piyush26c/Uber-Low-Level-Design

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uber Low Level System Design in C++

This project, Uber Low-Level System Design in 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 design in 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 pricing 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 DefaultPricingStrategy, RatingBasedPricingStrategy, 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 pricing 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
├── defaultPricingStrategy.hpp
├── driver.hpp
├── driverMatchingStrategy.hpp
├── driverMgr.cpp
├── driverMgr.hpp
├── leastTimeBasedMatchingStrategy.hpp
├── location.hpp
├── main.cpp
├── pricingStrategy.hpp
├── ratingBasedPricingStrategy.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

About

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

Topics

Resources

Stars

Watchers

Forks