Swift Collections gives you hybrid collection types like Deque, which is an array with “efficient insertions and removals at both ends”, OrderedSet, which is a “powerful hybrid of an Array and a Set”, and OrderedDictionary (like the actual dictionary).
And of course, they’re efficient. Now go forth and collect in new ways!
Whether it is attacked as an anti-pattern, malignedas untestable, or misused as a global convenience, singletons take a lot of 💩 for just being what they are: a way to enforce that there is only ever one of something. I think they should call this pattern “The One”.
A real life example of a singleton is The President of the United States. We only ever have one president at a time. That’s a key part of the concept. It’s not just a convenience.
Anyone can sing to this version, and then I can go back and re-record a few differently-styled instrumentations. I’m thinking a “dreamy” version, a “noisy” version, a 50’s version, a Weezer version, and a Walkmen version.
I don’t want six cars, a mansion, a helicopter, or even a fancy watch. Please, no. Just no.
I do want to travel, but not all the time. I could probably spend 1000 years happily just goofing around Central Texas.
But I do want to write a novel, make some music, raise some amazing kids, have a long and challenging career, learn to tell good stories and jokes, improve the world a bit, take care of myself, and be a good friend.
Am I asking too much? We shall see. 😆
We’re only given this one life, so you might as well at least try to make the most of it.
You’ll have it all I’ll have it all We’ll have it all