# Design Pattern Analysis Examples

## Example 1: Singleton Pattern

**Input:**
```
Explain the Singleton design pattern including when to use it and potential problems.
```

**Expected Output:**
Complete Singleton analysis with creational pattern classification, thread-safety considerations, global state issues, alternatives like dependency injection.

## Example 2: Observer Pattern for Event Systems

**Input:**
```
How does the Observer pattern work and how is it used in modern reactive programming?
```

**Expected Output:**
Observer pattern structure, subject-observer relationship, comparison with pub/sub, modern implementations in RxJS, Reactive Streams.

## Example 3: Pattern Selection

**Input:**
```
I need to create objects without specifying exact classes. Which pattern should I use?
```

**Expected Output:**
Recommendation for Factory patterns (Factory Method, Abstract Factory), comparison of approaches, use case analysis.

## Usage Tips

- Name the pattern for detailed analysis
- Describe the problem for pattern recommendations
- Ask about specific implementation languages
- Request comparisons between similar patterns
- Mention architectural constraints

## Common Use Cases

- Pattern selection for design problems
- Code refactoring to patterns
- Interview preparation
- Architecture reviews
- Legacy code modernization
- Framework design
