DEV Community

Sergey Leschev
Sergey Leschev

Posted on • Updated on

☔ Protection Proxy

Protection Proxy

The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object. Protection proxy is restricting access.



protocol DoorOpening {
    func open(doors: String) -> String

final class HAL9000: DoorOpening {
    func open(doors: String) -> String {
        return ("HAL9000: Affirmative, Dave. I read you. Opened \(doors).")
final class CurrentComputer: DoorOpening {
    private var computer: HAL9000!
    func authenticate(password: String) -> Bool {
        guard password == "pass" else {
            return false
        computer = HAL9000()
        return true

    func open(doors: String) -> String {
        guard computer != nil else {
            return "Access Denied. I'm afraid I can't do that."
        return doors)
Enter fullscreen mode Exit fullscreen mode


let computer = CurrentComputer()
let podBay = "Pod Bay Doors" podBay)

computer.authenticate(password: "pass") podBay)
Enter fullscreen mode Exit fullscreen mode

Sources: Github

In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.

🐝 Chain Of Responsibility
👫 Command Pattern
🎶 Interpreter Pattern
🍫 Iterator Pattern
💐 Mediator Pattern
💾 Memento Pattern
👓 Observer Pattern
🐉 State Pattern
💡 Strategy Pattern
📝 Template Method
🏃 Visitor Pattern
🌰 Abstract Factory
👷 Builder Pattern
🏭 Factory Method
🔂 Monostate Pattern
🃏 Prototype Pattern
💍 Singleton
🔌 Adapter Pattern
🌉 Bridge Pattern
🌿 Composite Pattern
🍧 Decorator Pattern
🎁 Facade Pattern
🍃 Flyweight Pattern
Protection Proxy
🍬 Virtual Proxy

I have a clear focus on time-to-market and don't prioritize technical debt. And I took part in the Pre-Sale/RFX activity as a System Architect, assessment efforts for Mobile (iOS-Swift, Android-Kotlin), Frontend (React-TypeScript) and Backend (NodeJS-.NET-PHP-Kafka-SQL-NoSQL). And I also formed the work of Pre-Sale as a CTO from Opportunity to Proposal via knowledge transfer to Successful Delivery.

🛩️ #startups #management #cto #swift #typescript #database
📧 Email:
👋 LinkedIn:
👋 LeetCode:
👋 Twitter:
👋 Github:
🌎 Website:
🌎 Reddit:
🌎 Quora:
🌎 Medium:
🖨️ PDF Design Patterns: Download

Top comments (0)