{"id":32492884,"url":"https://github.com/fkucukkara/design-patterns","last_synced_at":"2026-07-13T11:32:11.788Z","repository":{"id":318154225,"uuid":"1070169991","full_name":"fkucukkara/design-patterns","owner":"fkucukkara","description":"A professional implementation of the 23 classic Gang of Four (GoF) design patterns.","archived":false,"fork":false,"pushed_at":"2026-05-17T12:46:07.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T14:42:11.933Z","etag":null,"topics":["abstract-factory-pattern","adapter-pattern","architecture","behavioral-patterns","best-practices","creational-patterns","csharp","decorator-pattern","gof-patterns","netcore","practical-exercises","singleton-pattern","state-pattern","strategy-pattern","structural-patterns"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fkucukkara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-05T12:13:08.000Z","updated_at":"2026-05-17T12:46:10.000Z","dependencies_parsed_at":"2025-10-05T14:35:47.479Z","dependency_job_id":"d756b482-99db-4ec4-a405-a355c4d4d4e3","html_url":"https://github.com/fkucukkara/design-patterns","commit_stats":null,"previous_names":["fkucukkara/design-patterns"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fkucukkara/design-patterns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fdesign-patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fdesign-patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fdesign-patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fdesign-patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fkucukkara","download_url":"https://codeload.github.com/fkucukkara/design-patterns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fdesign-patterns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35421716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract-factory-pattern","adapter-pattern","architecture","behavioral-patterns","best-practices","creational-patterns","csharp","decorator-pattern","gof-patterns","netcore","practical-exercises","singleton-pattern","state-pattern","strategy-pattern","structural-patterns"],"created_at":"2025-10-27T11:56:20.117Z","updated_at":"2026-07-13T11:32:11.783Z","avatar_url":"https://github.com/fkucukkara.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Design Patterns Educational Demo\n\nA professional implementation of the 23 classic Gang of Four (GoF) design patterns in **C# 14** with **.NET 10.0**. This project serves as a practical reference for mid to senior-level software engineers.\n\n## Overview\n\nClean, straightforward implementations of all 23 GoF design patterns with:\n\n- **Simple, focused examples** that demonstrate core concepts\n- **Professional C# code** following modern best practices\n- **Interactive console application** for easy exploration\n- **No unnecessary complexity** - direct and to the point\n\n## Project Structure\n\n```\ndesign-patterns/\n├── Infrastructure/\n│   ├── IPatternDemo.cs         # Pattern interface\n│   └── PatternMenuManager.cs   # Console menu system\n├── Patterns/\n│   ├── Creational/             # 5 creational patterns\n│   ├── Structural/             # 7 structural patterns\n│   └── Behavioral/             # 12 behavioral patterns\n└── Program.cs                  # Application entry point\n```\n\n## Getting Started\n\n### Prerequisites\n- .NET 10.0 SDK or later\n- Any C# IDE (Visual Studio, VS Code, Rider)\n\n### Running the Application\n```bash\ngit clone https://github.com/fkucukkara/design-patterns.git\ncd design-patterns\ndotnet build\ndotnet run --project design-patterns\n```\n\nThe application provides an interactive menu to explore patterns by category:\n\n1. **Select a category** (Creational, Structural, or Behavioral)\n2. **Choose a specific pattern** to see its implementation\n3. **View the demonstration** with clear, focused examples\n\n## Implemented Patterns\n\n### Creational Patterns (5/5) ✅\n- [x] **Factory Method** - Payment processor creation system\n- [x] **Abstract Factory** - Cross-platform UI component families\n- [x] **Builder** - Complex database configuration construction\n- [x] **Prototype** - Document template cloning system\n- [x] **Singleton** - Configuration and resource management\n\n### Structural Patterns (7/7) ✅\n- [x] **Adapter** - Payment gateway integration system\n- [x] **Bridge** - Remote control for different devices\n- [x] **Composite** - File system hierarchy representation\n- [x] **Decorator** - Coffee ordering and text formatting system\n- [x] **Facade** - Home theater system simplification\n- [x] **Flyweight** - Tree forest memory optimization\n- [x] **Proxy** - Image lazy loading system\n\n### Behavioral Patterns (12/12) ✅\n- [x] **Chain of Responsibility** - Support ticket handling system\n- [x] **Command** - Smart home automation with undo functionality\n- [x] **Iterator** - Book collection traversal system\n- [x] **Mediator** - Chat room communication system\n- [x] **Memento** - Text editor undo/redo functionality\n- [x] **Observer** - Stock price monitoring and news publishing\n- [x] **State** - Traffic light state transitions\n- [x] **Strategy** - Shipping cost calculation and payment processing\n- [x] **Template Method** - Beverage preparation algorithm\n- [x] **Visitor** - Shape calculation operations\n- [x] **Pipeline** - Order processing, text transformation, and HTTP middleware simulation\n\n## 💡 Pattern Examples Overview\n\n### Factory Method Pattern\n**Scenario:** Payment processor creation system\n- Creates different payment processors (Credit Card, PayPal, Bank Transfer, Crypto)\n- Demonstrates object creation without specifying exact classes\n- Shows how to handle unsupported payment types gracefully\n\n### Abstract Factory Pattern\n**Scenario:** Cross-platform UI component system\n- Creates families of related UI components (Windows, macOS, Linux themes)\n- Ensures components from the same family work together\n- Demonstrates platform-specific implementations\n\n### Builder Pattern\n**Scenario:** Database configuration system\n- Constructs complex database configurations step by step\n- Provides both traditional builder and fluent interface approaches\n- Handles optional parameters and validation\n\n### Prototype Pattern\n**Scenario:** Document template system\n- Clones document templates for customization\n- Demonstrates both shallow and deep cloning approaches\n- Uses JSON serialization for reliable deep cloning\n\n### Singleton Pattern\n**Scenario:** Configuration and resource management\n- Shows thread-safe implementations using `Lazy\u003cT\u003e`\n- Demonstrates practical use cases (logging, caching, configuration)\n- Compares different singleton implementation approaches\n\n### Decorator Pattern\n**Scenario:** Coffee ordering and text formatting system\n- Adds functionality to objects dynamically without altering their structure\n- Demonstrates multiple decorators (milk, sugar, caramel, etc.) for coffee customization\n- Shows text formatting decorators (bold, italic, underline, color)\n- Illustrates flexible composition of features\n\n### Command Pattern\n**Scenario:** Smart home automation system\n- Encapsulates requests as objects for parameterization and queuing\n- Demonstrates macro commands that execute multiple actions\n- Implements comprehensive undo/redo functionality\n- Shows command scheduling and queuing capabilities\n\n### Observer Pattern\n**Scenario:** Stock market monitoring system\n- Implements subject-observer relationships for price notifications\n- Shows one-to-many dependencies with automatic updates\n- Demonstrates category-based subscriptions with news publishing\n\n### Strategy Pattern\n**Scenario:** Shipping cost calculation system\n- Encapsulates different algorithms for shipping cost calculation\n- Allows runtime algorithm selection\n- Shows multiple strategy examples (shipping, payment, sorting)\n\n### Pipeline Pattern\n**Scenario:** Order processing, text transformation, and HTTP middleware chain\n- Composes independent processing steps into a linear, reusable workflow\n- Demonstrates an order context flowing through parse → validate → discount → tax → receipt stages\n- Shows text transformation with trim, normalize, sanitize, truncate, and capitalize steps\n- Simulates ASP.NET-style middleware (logging → auth → rate-limiting → handler) with early-abort support\n\n## 🛠️ Technology Features\n\n### Modern C# 14 Features Used\n- **File-scoped namespaces** for cleaner code organization\n- **Nullable reference types** for better null safety\n- **Pattern matching** with switch expressions\n- **Primary constructors** where appropriate\n- **Record types** for immutable data models\n- **Global using statements** for common imports\n\n### .NET 10.0 Features\n- **Latest performance improvements**\n- **Enhanced nullable annotations**\n- **Improved JSON serialization**\n- **Better async/await patterns**\n\n### Best Practices Demonstrated\n- **SOLID principles** throughout the codebase\n- **Dependency injection** patterns where applicable\n- **Exception handling** with meaningful error messages\n- **Documentation** with XML comments and examples\n- **Clean code** principles with descriptive naming\n- **Separation of concerns** with proper layering\n\n## 🎓 Learning Path\n\n### For Beginners\n1. Start with **Creational Patterns** to understand object creation\n2. Move to **Structural Patterns** to learn about object composition\n3. Explore **Behavioral Patterns** to understand object interaction\n\n### For Each Pattern\n1. **Read the description** in the interactive menu\n2. **Run the demonstration** to see the pattern in action\n3. **Examine the code** to understand the implementation\n4. **Try modifying** the examples to test your understanding\n\n### Suggested Study Order\n1. **Factory Method** - Simplest creational pattern\n2. **Observer** - Fundamental behavioral pattern\n3. **Strategy** - Commonly used behavioral pattern\n4. **Adapter** - Essential structural pattern\n5. **Decorator** - Flexible structural pattern\n6. **Command** - Powerful behavioral pattern with undo support\n7. **Singleton** - Widely used but often misused\n8. Continue with remaining patterns\n\n## 🔧 Development Setup\n\n### Building and Testing\n```bash\n# Clean build\ndotnet clean\ndotnet build\n\n# Run with verbose output\ndotnet run --project design-patterns --verbosity detailed\n\n# Build for release\ndotnet build --configuration Release\n```\n\n### Code Style\nThe project follows the coding standards defined in `.editorconfig`:\n- File-scoped namespaces\n- 4-space indentation\n- PascalCase for public members\n- camelCase for private fields\n- Comprehensive XML documentation\n\n## 📖 Additional Resources\n\n### Design Patterns References\n- **Gang of Four Book:** \"Design Patterns: Elements of Reusable Object-Oriented Software\"\n- **Head First Design Patterns** - Excellent for beginners\n- **Refactoring.Guru** - Interactive pattern explanations\n- **Microsoft Documentation** - C# and .NET best practices\n\n### C# and .NET Resources\n- [C# Programming Guide](https://docs.microsoft.com/en-us/dotnet/csharp/)\n- [.NET 10.0 Documentation](https://docs.microsoft.com/en-us/dotnet/)\n- [C# Coding Conventions](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)\n\n## License\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Fdesign-patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffkucukkara%2Fdesign-patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Fdesign-patterns/lists"}