DRYing up duplicate code into helper functions We often assume it’s clear what it means to DRY up duplicated code. But it’s worth examining what DRY really means, and why it’s important.
Parent-Child Communication in a Coordinator/View Model Application I received an interesting question via Twitter last week: @cdzombak In the coordinator/MVVM architecture you described on @fatalerrorfm, how do ParentVC communicate with childVC. PC->PVM->Cord->CVM? — Cory Sullivan (@jcsully98) January 12, 2017 It took me a few days to find the time to write …
Modeling polymorphic relationships in Swift (spoiler: enums seem pretty cool) In traditional Objective-C code, we’d typically use protocols to express a polymorphic relationship. In Swift, we can take advantage of the language’s powerful enumerations to model these relationships, eliminate runtime type checks, and remove room for error in client code.
‘Obviously super complex’: evaluating software architecture as simple vs. easy I have a problem with the characterization of VIPER, right out of the gate, as across-the-board “obviously super complex”, for a few reasons.
Multiple Inheritance vs. Traits or Protocol Extensions A friend asked me at WWDC how Swift protocol extensions (or Scala traits, or Ruby mixins) are substantially better than multiple inheritance. Here are a few links and thoughts.
Cocoa’s mutable-subclass pattern is an antipattern We know we can’t mutate a mutable array while enumerating, and yes, we have to take care to avoid that. But wait a second—why is that *our* problem, as users of Apple’s Foundation framework?
Real World Singleton Design A discussion of practical architectural concerns when designing a singleton for a real-world iOS application.
Quick followup on singletons Part of the Singletons series. This is a quick followup to my post about singletons in Cocoa apps. Read it first for context. Another developer asked me a few questions about the points I made in my previous post on singletons. I’d like to post my (lightly edited) comments …
Singletons in Cocoa applications Part of the Singletons series. The Singleton pattern is a powerful tool in every programmer’s toolbox. But singletons today are widely overused in most codebases. The consequences of misusing such a powerful tool are too far-reaching and long-lived to take lightly. And overuse or misuse of this tool leads …