- 授权协议: GPLv3
- 开发语言: Swift
- 操作系统: OS X
- 软件首页: https://github.com/ochococo/Design-Patterns-In-Swift
- 官方下载: https://github.com/ochococo/Design-Patterns-In-Swift
软件介绍
Design Patterns 是如何使用常用设计模式及示例。
示例:
class MoneyPile { let value: Int
var quantity: Int
var nextPile: MoneyPile? init(value: Int, quantity: Int, nextPile: MoneyPile?) { self.value = value self.quantity = quantity self.nextPile = nextPile
} func canWithdraw(var v: Int) -> Bool { func canTakeSomeBill(want: Int) -> Bool { return (want / self.value) > 0
} var q = self.quantity while canTakeSomeBill(v) { if (q == 0) { break
}
v -= self.value
q -= 1
} if v == 0 { return true
} else if let next = self.nextPile { return next.canWithdraw(v)
} return false
}
}class ATM {
private var hundred: MoneyPile
private var fifty: MoneyPile
private var twenty: MoneyPile
private var ten: MoneyPile
private var startPile: MoneyPile { return self.hundred
} init(hundred: MoneyPile,
fifty: MoneyPile,
twenty: MoneyPile,
ten: MoneyPile) { self.hundred = hundred self.fifty = fifty self.twenty = twenty self.ten = ten
} func canWithdraw(value: Int) -> String { return "Can withdraw: \(self.startPile.canWithdraw(value))"
}
}程式之美-微軟技術面試心得
編程之美小 / 悅知文化 / 2008.06.20 / 490元
書內容分為以下幾個部分: ▓ 遊戲之樂:從遊戲和其他有趣問題出發,化繁為簡,分析總結。 ▓ 數字之魅:程式設計的過程實際上就是和數字及字元打交道的過程。這一部分收集了一些這方面的有趣探討。 ▓ 結構之法:彙集了常見的對字串、鏈表、佇列,以及樹進行操作的題目。 ▓ 數學之趣:列舉了一些不需要寫具體程式的數學問題,鍛煉讀者的抽象思考能力。 ▓ 書中絕大部分題目都提供了詳細......一起来看看 《程式之美-微軟技術面試心得》 这本书的介绍吧!
