Last active
February 25, 2017 08:48
-
-
Save shabib87/268fa42786f63b6b2cbaa420eedcaea4 to your computer and use it in GitHub Desktop.
In support to blog post https://codewithshabib.com/2017/02/25/dealing-with-telescopic-constructors-anti-pattern/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Biriyani { | |
let count: Int | |
let size: OrderSize | |
let spiceRange: SpiceRange | |
let type: BiriyaniType | |
init (count: Int = 1, size: OrderSize = .medium, spiceRange: SpiceRange = .spicy, type: BiriyaniType = .nonveg) { | |
self.count = count | |
self.size = size | |
self.spiceRange = spiceRange | |
self.type = type | |
} | |
} | |
class Restaurant { | |
var biriyaniOrder1 = Biriyani(size: .medium, spiceRange: .extraHot) | |
var biriyaniOrder2 = Biriyani(spiceRange: .extraHot) | |
... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment