Arslan Ahmadโ€™s Post

View profile for Arslan Ahmad, graphic

Author of Bestselling 'Grokking' Courses on System Design & Coding interviews | Co-Founder of DesignGurus.io

๐—ช๐—ต๐—ฒ๐—ป ๐˜๐—ผ ๐˜€๐—ฒ๐—น๐—ฒ๐—ฐ๐˜ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป๐ฌ? Choosing the correct design pattern in software engineering is critical to practical problem-solving. This post will try to simplify the process, helping you decide between patterns based on specific needs. To select a pattern, we must first go through the problem identification. If the problem is related to: ๐Ÿ”ธ Object Creation? โ†’ Creational Patterns ๐Ÿ”ธ Object Assembly? โ†’ Structural Patterns ๐Ÿ”ธ Object Interactions? โ†’ Behavioral Patterns 1. Singleton: Ensures only one instance exists. 2. Factory Method: Delegates object instantiation to subclasses. 3. Abstract Factory: Creates related object families without specifying their concrete classes. 4. Prototype: Clones objects for a prototypical instance. 5. Builder: Constructs complex objects step by step. 6. Adapter: Bridges incompatible interfaces. 7. Bridge: Separates abstraction from implementation. 8. Composite: Treats single and composite objects uniformly. 9. Decorator: Adds behaviors to objects dynamically. 10. Facade: Simplifies complex system interfaces. 11. Flyweight: Shares objects to reduce memory. 12. Proxy: Controls object access. 13. Observer: Notifies changes to multiple objects. 14. Strategy: Encapsulates interchangeable algorithms. 15. Command: Encapsulates a request as an object. 16. State: Changes object behavior with internal state. 17. Visitor: Adds operations to object structures without modifying them. 18. Memento: Captures and restores object states externally. 19. Iterator: Sequentially accesses elements of a collection. 20. Mediator: Centralizes complex communications. 21. Chain of Responsibility: Passes requests along a chain of handlers. 22. Template Method: Defines the skeleton of an algorithm. โžก Reference: ๐†๐ซ๐จ๐ค๐ค๐ข๐ง๐  ๐ƒ๐ž๐ฌ๐ข๐ ๐ง ๐๐š๐ญ๐ญ๐ž๐ซ๐ง๐ฌ ๐Ÿ๐จ๐ซ ๐„๐ง๐ ๐ข๐ง๐ž๐ž๐ซ๐ฌ ๐š๐ง๐ ๐Œ๐š๐ง๐š๐ ๐ž๐ซ๐ฌ - https://lnkd.in/gHYiMuEh โžก Join my newsletter to learn tips on system design and problem-solving: https://lnkd.in/gpHAFd9t #designpatterns #systemdesign #softwarearchitecture Design Gurus

  • No alternative text description for this image

Woww..! This reminds us of one of our projects! The client was in the financial services industry. They needed a centralized notification system. The purpose was to send alerts and updates to different services and applications. So, the Singleton pattern became our obvious choice. It was used to create a single instance of the notification manager. But, as their operations expanded, the singleton pattern began to show limitations: - Responsiveness - Maintenance complexity We thought of a solution and decided to transition, from a singleton pattern to an observer pattern. In this, the notification manager (Subject) maintained a list of dependent services (observers) that needed to be notified of changes or new alerts. Following this approach was helpful since we saw results like: - Improved scalability - Simplified maintenance. - Enhanced Responsiveness Thanks for bringing this up, Arslan Ahmad

Edu Prado

Head Of Software Engineering | Architecture | Development | Cloud Solutions Architecture

1mo

How about another types of design patterns ? Like EAI Or SOA design Patterns ? Why only GoF ?

kithinji brian

My mission is to create "made in Kenya" open source software.

1mo

I prefer pub/sub over observer because you can create topics and not flood all objects with event dispatches. This means you can use it as a central event data bus in your application. The rest are spot on. Kudos.

Like
Reply
Alex Gomez

Technical Consultant

1mo

Thanks for sharing this!

Like
Reply
Zara K.

Machine Learning Engineer/GenAI Data Engineer/MLOps/ LLMOps/LLM/NLP/AI/ML Engineer/Reinforcement Learning /Deep Reinforcement Learning/ Data Scientist/ Data Architect/Researcher/Developer/Deep Learning/Prompt Engineering

1mo

Thanks for sharing

Like
Reply
Jether Rodrigues

Senior Backend Engineer | Solutions Architect | OCAJP8 | Java | Kotlin | Node | Web3 | Solidity | Smart Contracts | Blockchain | Chainlink Advocate

1mo
Asil Acku

Full Stack - Senior Software Engineer | .NET, Java, Python, PHP - React, Vue | Cyber Security | Geek #NeverStopLearning

1mo

Its quite useful, thank you!

Like
Reply
Sharad Parbhoo

Senior Fullstack Software Engineer at Entelect

1mo

Legend

Imran Shaikh

Associate Technical Director @ Viu | OTT | Certified User Experience Analyst (CXA) | Leading and Driving the Initiative in Constructing Tech Communities, Team Formation, and Product Development from Scratch

1mo

Useful tips

Like
Reply
Ali Nour Al Din

Software Engineer | Backend | Javascript | Nodejs | System Design

1mo

Arslan Ahmad Thanks for your effort

Like
Reply
See more comments

To view or add a comment, sign in

Explore topics