Articles tagged "fundamentals"
-
I show how to structure programs around three tiers of computational units – statements, messages and reducers – and talk about the general problem of containing and isolating state that this restructuring aims to address.
-
There's an industry-wide push for protocol-oriented programming where shared interfaces, behaviors and substitutability are provided through protocols rather than subclasses. In this article though, I'll look at a case where I chose to use a subclass, instead of a protocol, to take advantage of some specific differences between classes and protocols.
-
I present an implementation of a a double-ended queue type (deque) in Swift and look at what is required to implement copy-on-write in an optimized way so that this double-ended queue is faster than Array when used as a first-in-first-out (FIFO) queue.
-
In this article, I'll discuss the Result type in Swift as well as common variations in implementation and approach used for this data type. I'll also look at *why* the type was rejected for inclusion in the standard library and what effect that rejection is likely to have.
-
Error handling is a topic I plan to visit periodically but it's difficult since 'error' is such a poorly defined term. In this article, I give a clear definition of an error and further define the most common associated complications. The intent is to establish a foundation for future discussions on the topic.
-
Partial functions (functions with preconditions) are a risky design choice. You probably have a few in your program, even if you haven't clearly identified them. Learn how to recognize them, learn about their risks, learn to avoid them and learn why you might choose to use them anyway.