Design Pattern
-
What is singleton pattern
•
2 min read
1. Intent Ensure a class has only one instance throughout the application, and provide a global point of access to that instance. 2. Problem 3. Solution 4. Real-World Analogy Think of a President of a country: 5. Structure 6. Pseudocode PHP Singleton Example Simple PHP Singleton Example (Counter)
-
What is a design pattern?
•
2 min read
A design pattern is a reusable solution to a commonly occurring problem in software design. It is not a piece of code that you copy-paste, but rather a general template or guideline for solving a particular type of problem in a flexible and maintainable way. Think of it like an architect’s blueprint — it doesn’t…
