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
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

- name: Install dependencies
run: npm install

- name: Build website
run: npm run build

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ jobs:

- name: Install dependencies
run: npm install

- name: Test build website
run: npm run build
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Each page follows a basic structure to ensure that a user can easily find metada

1. The name of the design pattern.
1. Include extra used names or alternative names used just below the title itself.
2. Each page needs a 'description' in the config, with a funny quote or otherwise short hook to get users engaged.
2. The group the design pattern belongs to.
1. Creational, Structural or Behavioral
3. Description
Expand Down
11 changes: 11 additions & 0 deletions docs/behavioral/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
label: Behavioral
link:
type: generated-index
title: Behavioral Design Patterns
description: >
Behavioral are focussed on communication, the assignment of responsibilities between objects and complex transactions such as algorithms.
slug: /behavioral
keywords:
- design pattern
- behavioral
- software architecture
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions docs/creational/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
label: Creational
link:
type: generated-index
title: Creational Design Patterns
description: >
Creational design patterns are all about class instantiation or object
creation. These patterns can be further divided into class-creation patterns
and object-creational patterns. While class-creation patterns use inheritance
effectively in the instantiation process, object-creation patterns use
delegation to get the job done.
slug: /creational
keywords:
- design pattern
- creational
- software architecture
8 changes: 5 additions & 3 deletions docs/Creational/builder.mdx → docs/creational/builder.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Builder
hide_title: true
description: >
Can we build? Yes we can! Do we need a Director? Maybe..?
---

import { CreationalPatternTag } from "@site/src/components/pattern-page-features/pattern-alias-and-tag";
Expand Down Expand Up @@ -411,9 +413,9 @@ function BuilderDemo() {
```

## 🔗Relations to other patterns
- The Builder pattern is often used in conjunction with the [Factory Method](/docs/Creational/factory-method) pattern, where the factory method creates a builder instance.
- You can combine [Builder](/docs/Creational/builder) with [Bridge](/docs/Structural/bridge): the director class plays the role of the abstraction, while different builders act as implementations.
- [Abstract Factories](/docs/Creational/abstract-factory), [Builders](/docs/Creational/builder), and [Prototype](/docs/Creational/prototype) can be implemented as [Singleton](/docs/Creational/singleton).
- The Builder pattern is often used in conjunction with the [Factory Method](/docs/creational/factory-method) pattern, where the factory method creates a builder instance.
- You can combine [Builder](/docs/creational/builder) with [Bridge](/docs/structural/bridge): the director class plays the role of the abstraction, while different builders act as implementations.
- [Abstract Factories](/docs/creational/abstract-factory), [Builders](/docs/creational/builder), and [Prototype](/docs/creational/prototype) can be implemented as [Singleton](/docs/creational/singleton).

---

Expand Down
File renamed without changes.
10 changes: 6 additions & 4 deletions docs/Creational/prototype.mdx → docs/creational/prototype.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Prototype
hide_title: true
description: >
Double the copies, double the fun.
---

import { CreationalPatternTag } from "@site/src/components/pattern-page-features/pattern-alias-and-tag";
Expand Down Expand Up @@ -198,10 +200,10 @@ function PrototypeDemo() {
```

## 🔗Relations to other patterns
- Designs that make heavy use of [Composite](/docs/Structural/composite.mdx) and [Decorator](/docs/Structural/decorator.mdx) can often benefit from using [Prototype](/docs/Creational/prototype). Applying the pattern lets you clone complex structures instead of re-constructing them from scratch.
- [Prototypes](/docs/Creational/prototype) can help when you need to save copies of [Commands](/docs/Behavioural/command.mdx) into history.
- [Abstract Factories](/docs/Creational/abstract-factory) classes are often based on a set of [Factory Methods](/docs/Creational/factory-method.mdx), but you can also use [Prototype](/docs/Creational/prototype) to compose the methods on these classes.
- [Abstract Factories](/docs/Creational/abstract-factory), [Builders](/docs/Creational/builder), and [Prototypes](/docs/Creational/prototype) can be implemented as [Singleton](/docs/Creational/singleton).
- Designs that make heavy use of [Composite](/docs/structural/composite.mdx) and [Decorator](/docs/structural/decorator.mdx) can often benefit from using [Prototype](/docs/creational/prototype). Applying the pattern lets you clone complex structures instead of re-constructing them from scratch.
- [Prototypes](/docs/creational/prototype) can help when you need to save copies of [Commands](/docs/behavioral/command.mdx) into history.
- [Abstract Factories](/docs/creational/abstract-factory) classes are often based on a set of [Factory Methods](/docs/creational/factory-method.mdx), but you can also use [Prototype](/docs/creational/prototype) to compose the methods on these classes.
- [Abstract Factories](/docs/creational/abstract-factory), [Builders](/docs/creational/builder), and [Prototypes](/docs/creational/prototype) can be implemented as [Singleton](/docs/creational/singleton).

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Singleton
hide_title: true
description: >
Just like God, there is only one.
---

import { CreationalPatternTag } from "@site/src/components/pattern-page-features/pattern-alias-and-tag";
Expand Down Expand Up @@ -196,9 +198,9 @@ function SingletonDemo() {
```

## 🔗Relations to other patterns
- [Factory Method](../Creational/factory-method.mdx), [Abstract Factory](../Creational/abstract-factory.mdx), or [Builder](../Creational/builder.mdx) may rely on Singleton to ensure a single configuration or product source is used globally.
- [Facade](../Structural/facade.mdx) objects can themselves be singletons that encapsulate a subsystem behind a single interface.
- Unlike [Flyweight](../Structural/flyweight.mdx), which manages many shared objects, Singleton restricts creation to precisely one object.
- [Factory Method](/docs/creational/factory-method.mdx), [Abstract Factory](/docs/creational/abstract-factory.mdx), or [Builder](/docs/creational/builder.mdx) may rely on Singleton to ensure a single configuration or product source is used globally.
- [Facade](/docs/structural/facade.mdx) objects can themselves be singletons that encapsulate a subsystem behind a single interface.
- Unlike [Flyweight](/docs/structural/flyweight.mdx), which manages many shared objects, Singleton restricts creation to precisely one object.

---

Expand Down
47 changes: 0 additions & 47 deletions docs/intro.md

This file was deleted.

37 changes: 37 additions & 0 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Overview
sidebar_position: 1
---

# Welcome to DesignPatternPedia

Ever come across a piece of code and thought, “Why is this written like a Sudoku puzzle?” Congratulations, you’ve found a design pattern (assuming it's not some DIY project...).

This site is your map to the collection of reusable solutions that help developers build reliable and maintainable software across different contexts and technologies.

## So… what even is this?

This documentation is a structured reference for software design patterns — recurring approaches to solving frequently encountered problems in software architecture and object-oriented design.

Each pattern here summarizes a proven solution, the problem it addresses, and the trade-offs involved in applying it.
Understanding these patterns helps you write code that is consistent, maintainable, and adaptable to change.

## For who is this?

It is primarily aimed at (junior) software developers, but anyone is welcome to take a look! The documents can get a bit technical at times, so a bit of programming background is strongly recommended in order to not get completely lost.

## How does it work?

Patterns are grouped into three core categories, each describing a different perspective on how code can be organized and behave:

- **Creational Patterns** – Deal with object creation and instantiation logic, aiming for flexibility and control over how objects are constructed. [Explore Creational Patterns ›](/docs/creational)

- **Structural Patterns** – Focus on how classes and objects are composed to form larger structures while maintaining efficiency and scalability. [Explore Structural Patterns ›](/docs/structural)

- **Behavioral Patterns** – Describe how objects interact and communicate, defining responsibilities and coordination in software systems. [Explore Behavioral Patterns ›](/docs/behavioral)

Each core group then has it's own pattern page, which describes various aspects of the pattern itself. Subjects such as when to apply it, what it means, a metaphor to really connect it to reality and so forth. Pick a page and start reading from top to bottom.

## Why does this exist?

Software development often faces the same challenges — managing complexity, reducing coupling, and maintaining flexibility. Design patterns offer shared language and principles that developers can rely on to design systems that are easier to extend and understand. The existing website all lack a certain flavour, some are too complex and detailed, some simply do not contain enough precision. I hope to create an overarching experience which actually focusses on helping (junior) developers learn design patterns.
11 changes: 11 additions & 0 deletions docs/structural/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
label: Structural
link:
type: generated-index
title: Structural Design Patterns
description: >
Structural design patterns are concerned with how classes and objects are composed to form larger structures.
slug: /structural
keywords:
- design pattern
- structural
- software architecture
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This sample is to get a 'feel' for the pattern. The code itself may not reflect
```

## 🔗Relations to other patterns
- [Another pattern](./Creational/singleton.mdx) wiki link here
- Another pattern wiki link here
---

## 📚Sources
Expand Down
32 changes: 19 additions & 13 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,26 @@ const config: Config = {
},
items: [
{
type: "docSidebar",
sidebarId: "tutorialSidebar",
position: "left",
label: "Patterns",
to: "/docs/overview",
label: "Overview",
},
{
position: "left",
to: "docs/behavioral",
label: "Behavioral",
},
{
position: "left",
to: "docs/creational",
label: "Creational",
},
{
position: "left",
to: "docs/structural",
label: "Structural",
},
{ to: "/manifest", label: "Manifesto", position: "left" },
{
href: "https://github.com/S7-OpenLearning-Individual/DesignPatternPedia",
label: "GitHub",
Expand All @@ -76,16 +91,7 @@ const config: Config = {
style: "dark",
links: [
{
title: "Docs",
items: [
{
label: "Tutorial",
to: "/docs/intro",
},
],
},
{
title: "More",
title: "Contribute & Feedback",
items: [
{
label: "GitHub",
Expand Down
22 changes: 21 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"swiper": "^12.0.3"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.9.2",
Expand Down
18 changes: 2 additions & 16 deletions sidebars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

Expand All @@ -13,21 +13,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
Create as many sidebars as you want.
*/
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],

// But you can create a sidebar manually
/*
tutorialSidebar: [
'intro',
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
*/
sidebar: [{ type: "autogenerated", dirName: "." }],
};

export default sidebars;
Loading