Skip to content

olarn/GoF-Design-Pattern

Repository files navigation

Design Patterns Code Kata

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.

Project Structure

Each design pattern folder contains three sub-directories:

  • begin/ - Contains starter code for practicing the pattern
  • finish/ - Contains the complete implementation as reference
  • lab/ - 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 begin and finish folders to avoid IDE confusion due to duplicate class names. Keep only the lab folder for your implementation.

Cleanup Command

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

Project Setup

Prerequisites

Development Environment

Using Nix (Optional)

To set up the development environment using Nix:

nix-shell

For more information about Nix, visit nixos.org

DevBox

To set up the development environment using DevBox:

devbox shell

For more information about DevBox, visit devbox.com

Running the Project

Tests

To run tests with watch mode, navigate to the /code directory and execute:

npm run test

or

npm test

To run specific test file (with watch by default):

npm test -- <folder>/<test_file>.ts

Development Server

To run the application in development mode with watch:

npm run dev

Project Documentation

UML Diagrams

The project includes UML diagrams created with StarUML. To view them:

  1. Download and install StarUML from staruml.io
  2. Open the Diagram.mdj file in StarUML

References

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages