This project contains implementations of Gang-of-Four Design Patterns, based on examples from the Head First Design Patterns book with NodeJS and Typescript. Each pattern is organized in its own directory under the code folder.
Each design pattern folder contains three sub-directories:
begin/- Contains starter code for practicing the patternfinish/- Contains the complete implementation as referencelab/- Your workspace for implementing the pattern
code/
├── pattern1/
│ ├── begin/
│ ├── finish/
│ └── lab/
├── pattern2/
│ ├── begin/
│ ├── finish/
│ └── lab/
└── ...
Note: Before starting the code kata, it's recommended to delete the
beginandfinishfolders to avoid IDE confusion due to duplicate class names. Keep only thelabfolder for your implementation.
To remove begin and finish folders:
For Unix/Linux/MacOS:
find . -type d \( -name "begin" -o -name "finish" \) \
-exec rm -rf {} +For Windows (PowerShell):
Get-ChildItem -Directory -Recurse -Filter "begin","finish" |
Remove-Item -Recurse -Force- Node.js
- Typescript
- Nix (optional)
- StarUML (optional - for viewing diagrams)
- Recommended plugins :- VSCode Jest https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest
To set up the development environment using Nix:
nix-shellFor more information about Nix, visit nixos.org
To set up the development environment using DevBox:
devbox shellFor more information about DevBox, visit devbox.com
To run tests with watch mode, navigate to the /code directory and execute:
npm run testor
npm test
To run specific test file (with watch by default):
npm test -- <folder>/<test_file>.ts
To run the application in development mode with watch:
npm run devThe project includes UML diagrams created with StarUML. To view them:
- Download and install StarUML from staruml.io
- Open the
Diagram.mdjfile in StarUML