https://github.com/piyush26c/uber-low-level-design
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).
https://github.com/piyush26c/uber-low-level-design
cpp11 cpp17 locks object-oriented-programming singleton-design-pattern standard-template-library stl-containers strategy-design-pattern system-design uml-class-diagram
Last synced: about 2 months ago
JSON representation
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).
- Host: GitHub
- URL: https://github.com/piyush26c/uber-low-level-design
- Owner: piyush26c
- Created: 2024-02-13T22:25:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-23T15:06:34.000Z (9 months ago)
- Last Synced: 2025-01-20T15:59:13.590Z (3 months ago)
- Topics: cpp11, cpp17, locks, object-oriented-programming, singleton-design-pattern, standard-template-library, stl-containers, strategy-design-pattern, system-design, uml-class-diagram
- Language: HTML
- Homepage:
- Size: 448 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.*

## Steps to Run the Project
1. **Clone the Repository**
```sh
git clone https://github.com/piyush26c/Uber-Low-Level-Design.git
cd Uber-Low-Level-Design
```2. **Create a Build Directory**
```sh
mkdir build
cd build
```3. **Generate the Build System using CMake**
```sh
cmake ..
```4. **Build the Project**
```sh
make
```5. **Run the Executable**
```sh
./UberSystem
```## Project Structure
```sh
├── 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


 

## Authors- [Piyush Rajendra Chaudhari](https://github.com/piyush26c)