---
title: "Discussion on \"Design Patterns\" | Hashnode"
description: "Discussion on \"Design Patterns\". 1. Strategy Pattern\nWhen to Use:\n\nMultiple algorithms or behaviours for the same task\n\nNeed to switch logic at runtime\n\nWant to avoid big if-else or switch statements\n\n\n\nExample: Payment System\n❌ What NOT to do\nif (type.equals(\"CARD\")) {\n    // card ..."
url: "https://hashnode.com/posts/design-patterns/695dcf014adf7034f53526e7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Design Patterns](https://backendtechie.hashnode.dev/design-patterns?utm_source=hashnode&utm_medium=feed)

1\. Strategy Pattern When to Use: Multiple algorithms or behaviours for the same task Need to switch logic at runtime Want to avoid big if-else or switch statements Example: Payment System ❌ What NOT to do if (type.equals("CARD")) { // card ...

Jan 7 · 4 min read · backendtechie.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#design-patterns](https://hashnode.com/tag/design-patterns)
-   [#coding](https://hashnode.com/tag/coding)
-   [#strategypattern](https://hashnode.com/tag/strategypattern)
-   [#strategy-design-pattern](https://hashnode.com/tag/strategy-design-pattern)
-   [#factory-design-pattern](https://hashnode.com/tag/factory-design-pattern)
-   [#builder-pattern](https://hashnode.com/tag/builder-pattern)
-   [#lld-backend](https://hashnode.com/tag/lld-backend)
-   [#lowleveldesign](https://hashnode.com/tag/lowleveldesign)

## Written by

[Kartik Gupta](https://hashnode.com/@thebackendtechie)

@thebackendtechie

  
[View profile](https://hashnode.com/@thebackendtechie)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
