Skip to content

Latest commit

 

History

History
70 lines (44 loc) · 1.97 KB

readme.md

File metadata and controls

70 lines (44 loc) · 1.97 KB

S.Leschev Design Patterns (Swift 5+)

Google Engineering Level: L6+

🏆 Awards

Ranking #Dev: Global TOP 300 (Certificate)

Sergey Leschev

Languages: Swift, Shell, Database (T-SQL, PL/SQL, MySQL), Concurrency (Python3).

Algorithms: linked lists, binary search, hash table, queue/stack, dfs/bfs, sort, heap/hash, two pointers, sliding window, tree, greedy problems etc.

🃏 Prototype

The prototype pattern is used to instantiate a new object by copying all of the properties of an existing object, creating an independent clone. This practise is particularly useful when the construction of a new object is inefficient.

Example

class MoonWorker {

    let name: String
    var health: Int = 100

    init(name: String) {
        self.name = name
    }

    func clone() -> MoonWorker {
        return MoonWorker(name: name)
    }
}

Usage

let prototype = MoonWorker(name: "Sam Bell")

var bell1 = prototype.clone()
bell1.health = 12

var bell2 = prototype.clone()
bell2.health = 23

var bell3 = prototype.clone()
bell3.health = 0

Contacts

I have a clear focus on time-to-market and don't prioritize technical debt.

🛩️ #startups #management #cto #swift #typescript #database

📧 Email: sergey.leschev@gmail.com

👋 LinkedIn: https://linkedin.com/in/sergeyleschev

👋 Twitter: https://twitter.com/sergeyleschev

👋 Github: https://github.com/sergeyleschev

🌎 Website: https://sergeyleschev.github.io

🖨️ PDF: Download

ALT: SIARHEI LIASHCHOU