Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

**Project Hierarchy**
```
includes/ → Header files (.h, .hpp)
src/ → Source files (.cpp)
tests/ → GoogleTest test cases
includes/ -> Header files (.h, .hpp)
src/ -> Source files (.cpp)
tests/ -> GoogleTest test cases
docs/ -> Documents
```

---
## 2. Dependencies
Make sure the following tools are installed before building the project:
- **g++ / gcc**
Expand All @@ -20,21 +22,20 @@ Make sure the following tools are installed before building the project:
- **cppcheck** (for static analysis)
- **Optional:** Install `clang-format` to format C++ code.

**Linux**
```bash
sudo apt install clang-format
find . -regex '.*\.\(cpp\|h\|hpp\)' -exec clang-format -i {} \;
```
**Windows**
```bash
# Install clang-format via Chocolatey
choco install clang-format

# Apply clang-format recursively to .cpp, .h, .hpp files
Get-ChildItem -Recurse -Include *.cpp, *.h, *.hpp | ForEach-Object { clang-format -i $_.FullName }
```
## 3. Setup
### 3.1. Setup the Local Test Environment
> Apply clang-format recursively to .cpp, .h, .hpp files
**Linux**
```bash
sudo apt install clang-format
find . -regex '.*\.\(cpp\|h\|hpp\)' -exec clang-format -i {} \;
```
**Windows**
```bash
Get-ChildItem -Recurse -Include *.cpp, *.h, *.hpp | ForEach-Object { clang-format -i $_.FullName }
```
---
## 3. Setup Environment
### 3.1. Dev
- **Ubuntu system**
* Install `gcc`, `cmake`, `git`, and `pthread` (Skip this step if you already install)
```bash
Expand Down Expand Up @@ -101,7 +102,7 @@ Get-ChildItem -Recurse -Include *.cpp, *.h, *.hpp | ForEach-Object { clang-forma
* `cpp-lab:latest`: the image you built earlier.
* `/bin/bash`: the command to execute inside the container (opens a Bash shell).

### 3.2 Config C/C++ Debugging (VS Code)
### 3.2 Debug - C/C++ Debugging (VS Code)

#### 3.2.1. Launch Configuration

Expand Down Expand Up @@ -235,7 +236,7 @@ Notes:
### 3.3 Documentation with `doxygen`
TBD - Refer to this [Documentation with doxygen](https://www.labri.fr/perso/fleury/posts/programming/using-cmake-googletests-and-gcovr-in-a-c-project.html#:~:text=of%20the%C2%A0project.-,Documentation%20with%20doxygen,-Code%20embedded%20documentation)

## 5. Update Docker Image
## 4. Docker Image
```bash
# Navigate to the project that contain your Dockerfile
cd cpp-lab
Expand All @@ -250,11 +251,11 @@ docker image ls
docker push DOCKER_USERNAME/cpp-lab
```

## 6. TroubleShooting
## 5. TroubleShooting
1. `push access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed`
=> docker login / Docker Desktop login

## 7. Evaluate Executable
## 6. Evaluate Executable
- List all sections:
```bash
$ size ./build/cpp-lab
Expand Down
29 changes: 29 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CPP Lab Docs

## Core

1. [Basic](../src/core/basics/README.md)
2. [Class](../src/core/class/README.md)
3. [Concurrency](../src/core/concurrency/README.md)
4. [Container](../src/core/container/README.md)
5. [Date time](../src/core/datetime/README.md)
6. [Exception](../src/core/exception/README.md)
7. [Expression](../src/core/expression/README.md)
8. [File handle](../src/core/filehandle/README.md)
9. [Smart pointer](../src/core/smart_pointer/README.md)
10. [String](../src/core/string/README.md)

## Design Patterns

11. [Behavioral](../src/dp/behavioral/README.md)
12. [Structural](../src/dp/structural/README.md)
13. [Creational](../src/dp/creational/README.md)

## Architecture Patterns

14. [MVC/MVVM](../src/ap/README.md)

## Other

15. [Socket](../src/socket/README.md)
16. [Google Test](../tests/README.md)
4 changes: 4 additions & 0 deletions docs/uml/ap/ap_mvvm_example.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ add_subdirectory(dp)
add_subdirectory(socket)
add_subdirectory(ap)

# main application executable does NOT link to this library.
add_subdirectory(leetcode)

# Header files directory
set(APP_HEADERS
${PROJECT_SOURCE_DIR}/include
Expand Down
19 changes: 14 additions & 5 deletions src/ap/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Architecture Patterns
### 1. MVVM
![Diagram](../../docs/uml/ap/ap_mvvm_example.drawio.svg)
- **MVVM (Model - View - ViewModel)** is an architecture pattern that separates the user interface (`View`) from the business logic and data (`Model`) through an intermediary component called the `ViewModel`
- **Components:**
- **Model**: responsible for managing and abstracting data sources (databases, APIs, ..).
Expand All @@ -17,10 +18,13 @@
6. The `ViewModel` updates the observable data, which automatically updates the `View` through `data binding or observers`.
```bash
User
View ↔ ViewModel ↔ Model # view automatically update
|
v
View <-> ViewModel <-> Model # view automatically update
(data binding)
```

---
### 2. MVC
![Diagram](../../docs/uml/ap/ap_mvc_example.drawio.svg)
- **MVC (Model - View - Controller)** is an architectural pattern that separates the user interface (`View`) from the application logic and data (`Model`) using an intermediary component called the `Controller`.
Expand All @@ -37,14 +41,19 @@ View ↔ ViewModel ↔ Model # view automatically update
5. The `Controller` then updates the `View` based on the new `Model` data.
```bash
User
View → Controller → Model
|
v
View -> Controller -> Model
|
v
View # view update manually
```

---
### 3. GTK4
- [Refer](https://docs.gtk.org/gtk4/getting_started.html)

---
### 4. Trade-offs: MVC vs MVVM

| Aspect | MVC | MVVM |
Expand Down
File renamed without changes.
26 changes: 0 additions & 26 deletions src/leetcode/CMakeLists.txt

This file was deleted.

65 changes: 0 additions & 65 deletions src/leetcode/arrays/3sum/Solution.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions src/leetcode/arrays/3sum/Solution.h

This file was deleted.

61 changes: 0 additions & 61 deletions src/leetcode/arrays/4sum/Solution.cpp

This file was deleted.

Loading
Loading