-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxy.cs
More file actions
21 lines (19 loc) · 826 Bytes
/
Proxy.cs
File metadata and controls
21 lines (19 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace DesignPatterns.Structural.Proxy;
/// <summary>
/// Proxy Pattern
///
/// Intent: Provide a surrogate or placeholder for another object to control access to it.
///
/// When to use:
/// - Virtual proxy: lazy-load expensive objects
/// - Protection proxy: control access based on permissions
/// - Remote proxy: represent an object in a different address space
/// - Smart proxy: add housekeeping logic (caching, reference counting)
///
/// Real-world analogy: A credit card is a proxy for a bank account —
/// it provides the same payment interface but adds security and tracking.
/// </summary>
// TODO: Implement Proxy
// 1. Subject interface (e.g., IResource)
// 2. Real subject class (the actual expensive/protected object)
// 3. Proxy class implementing Subject and controlling access to RealSubject