1. This Week I Learned #17

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • The coastline paradox refers to the phenomenon where the fractal nature of coastlines causes their length estimates to vary widely depending on the scale of the ruler used. This length tends towards infinity as the measurement unit gets smaller and smaller, going against the logical expectation when measuring a finite distance (via Marc Edwards).

    • The proportionality bias refers to our tendency to assume that major events have major causes. While it’s often cited as a likely reason people believe in conspiracy theories, it’s also why programmers spend hours debugging a problem, probing every nook and cranny, only to find out that the cause is much more trivial than what was anticipated.

    # Design

    • In 3D graphics software, namely Blender, a shadow catcher is a completely transparent material that “catches” and renders the shadows of other objects in the scene—useful when exporting 3D renders for further 2D composition and editing. When using the Cycles renderer in Blender, this is as easy as ticking a checkbox. In EEVEE, Blender 2.8’s new rendering engine, it requires using a custom shader to obtain a similar effect.

    # Programming

    • I went trough the first half of the Tour of Rust guide with the intention of getting more familiar with its syntax and memory management APIs. Beside the relationship between ownership and mutability, many of the concepts introduced in what I’ve seen so far felt quite similar to their Swift counterparts.
  2. I enjoyed Chris Krycho’s take on the idea, but I totally understand where he is coming from. Like any other commitment, it takes time and energy that might not always be readily available.

    After four months of running this experiment, I am starting to feel the pressure. Some weeks go by where I don’t learn much worth mentioning, or simply don’t have enough time to elaborate. But I remain convinced this is a habit I’d like to keep—if anything, it helps me rebuild confidence in my ability to follow through commitments of this kind.

  3. This Week I Learned #16

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • This week I picked up aws-sdk-swift with the goal of integrating with SES, Amazon’s cloud email service. After some initial struggle figuring out which API version to use and how, I managed to send emails from a server-side Swift app I am currently working on.

    • Some valuable lessons about S3, AWS billing, and CDNs by Chris Short (link).

    • SwiftUI’s new Menu component is now available on iOS 14 as of Beta 3. I suspect contextual menus to gain more traction on iOS and I am happy to see them join a growing list of SwiftUI components.

  4. This Week I Learned #15

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Understanding any topic in greater depth requires honesty, integrity, and patience. Thinking hard about the problem space and seeking first-hand experience also yields far deeper understanding than contenting oneself with the syntheses of others (link).

    • Beta invites to OpenAI’s API, powered by the new GPT-3 (paper), are starting to go out and some of the demos are generating a lot of buzz at the moment. This was the article that brought my attention to this.

    # Programming

    • How to properly use services in Vapor 4. I am still not fond of the amount of work involved, but it’s an effective way to extend the built-in capabilities of the default types.

    • How to use HTMLElement to build a custom DOM element that encapsulates structure, styling, and interactions (link).

    • How the isSource and properties arguments in SwiftUI’s matchedGeometryEffect work (link).

  5. On flatMapThrowing in SwiftNIO

    Johannes Weiss answering the question why flatMapThrowing (docs) is not a throwing flatMap:

    Functions that have this prototype: f() throws -> EventLoopFuture<Void> are in my view a bit user hostile. They can fail in two different ways: by throwing [and] by returning a failed future. That means a user needs to look for errors in two different places. […] On top of that: If an asynchronous function throws synchronously, is it really asynchronous?

    This one caught me off-guard more than once. Considering the signatures of map and flatmap (abridged for brevity):

    func map<NewValue>(callback: @escaping (Value) -> NewValue) -> EventLoopFuture<NewValue>
    func flatMap<NewValue>(callback: @escaping (Value) -> EventLoopFuture<NewValue>) -> EventLoopFuture<NewValue>

    It’s easy to assume that flatMapThrowing is a version of flatMap that takes a throwing closure of type (Value) throws -> EventLoopFuture<NewValue>. But that’s not the case.

    func flatMapThrowing<NewValue>(callback: @escaping (Value) throws -> NewValue) -> EventLoopFuture<NewValue>

    As for the name of the method, Johanness explains:

    Lots of people get confused by this, if I could choose again, I’d probably go for something like combineThrowing or so?

  6. How come “a11y”, the widely used numeronym of the word accessibility, is itself not accessible?

    Saving key strokes at the expense of readability is the antithesis of what accessibility stands for, in my opinion.

  7. This Week I Learned #14

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Lambertian surfaces and their photometric properties, through this stunning interactive guide by Bartosz Ciechanowski.1

    • I learnt quite a bit from this exploratory piece by Mattt about how core concepts from the Semantic Web can be used to make the code we write semantically richer, unlocking new authoring, distribution, and reuse possibilities in the process.

    # Programming

    • How the new matchGeometryEffect works in SwiftUI. This new API enables synchronizing view animations and transitions regardless of their place in the hierarchy. It’s quite powerful and will make some previously labor-intensive effects much easier to achieve (link 1, link 2).

    1. If you had asked me ten years ago about how Wikipedia or Wolfram Alpha would look in 2020, I’d have pictured something along the lines of Bartosz’s work. Yet, we’re absolutely nowhere near that. One can’t help but wonder if we have been focusing on the right things all these years.
  8. On Static Site Generators

    Peter Zignego writes about his experience with Swift static site generators:

    After a bit of spelunking, I realized that it had been built with some beta version of Xcode long since lost to the sands of time — I was stuck with a binary I couldn’t run.

    Luckily most of this is behind us now. Prior to 4.0, this was a major drawback of using the language for general purpose programming.

    Over the course of the week I spent converting this site to use Publish, I was frustrated by a lot of the built-in assumptions and general inflexibility. While I am sure that it is a great Swift by Sundell generator, it is not (yet) a great general-purpose static site generator.

    As a Website maintainer, finding a static site generator that works exactly the way you want is no small feat. I used a handful in the past 10 years, across personal and client projects, and I still haven’t found the one. Plugins and extensions do help, but there will always be a set of assumptions that are not true for every project.

    But the beauty of open source is exactly that, so I forked it and fixed my two biggest issues.

    If you’re going to use a static site generator, use one written in a language you are comfortable with. Sooner or later, you’ll find yourself in a position where you need to patch the build system to add new functionality or modify existing one, especially if you are making Websites for a living.

    In practice I found [using an HTML DSL] to be more clunky and mistake-prone than just writing HTML with Mustache templates, which is what I was converting from.

    Couldn’t agree more as someone who always preferred templating languages (Mustache, Liquid, etc) to DSLs. The latter often introduce friction that seems unnecessary if you are already comfortable with HTML and CSS.

    I‘m not head over heels in love with Gatsby, but it’s versatile and battle-tested. I‘ll eventually look into migrating to a Swift build system, but I can’t afford the time to do so for the time being.

  9. This Week I Learned #13

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • I am a bit late to the r/covidcookery party, but this weekend I baked my first cake ever! An okay-looking, totally edible pound cake. There’s definitely a lot of room for improvement, but the sense of achievement when I took it out of the oven and it wasn’t a complete mess is quite the feeling. Thanks Alaa for the hands-on tips!

    • It took quaternions 150 years after their discovery by Williams Rowan Hamilton to find practical uses such as 3D computer graphics and robotics. Immediate applicability is never the primary goal of mathematical research (article via Hacker News).

    • Gemini is a budding client-server protocol aiming to offer a bloat-free alternative to the HTTP Web. It uses a Markdown-inspired document format and completely forgoes client-side scripting and styling (source).

    • I saw a PC ad on Japanese TV that ended with the Intel Inside slogan:「インテル入ってる」(interu-haitteru). Pretty clever for a marketing localization, right? Well, as it turns out, the perfectly-rhyming Japanese slogan came first (!) and served as inspiration for the English version, according to Susumu Furukawa, the president of Microsoft Japan between 1986 and 1992 (source).

    # Programming

    • I totally missed this initially, but it’s possible starting iOS 14 to customize the navigation bar title in SwiftUI (link).
  10. Mattt on WWDC 2020

    It’s refreshing to see Mattt’s reasoned take amidst all the attention-seeking headlines this week:

    As it turns out, going fully remote wasn’t merely good enough — it was, in many ways, superior to the original thing. […] Sessions are tight and well-paced. Rather than stretching or cramming content into a fixed time slot, they’re as long as they need to be.

    This definitely echoes my impressions. As someone who mostly followed along from home in the past, not only did I not miss much this year, but I got treated to a much improved remote experience.

    Mattt also brings up the topic of Excitement—or hype, as I often call it—and productivity:

    Here’s the thing about excitement: It’s kryptonite to developers. Excitement messes with our ability to focus on one thing, which is already a big struggle for a lot of us (myself included). When you’re excited, it’s almost impossible to get anything done.

    This is true for any endeavor, but especially so for software development.

    There are plenty of voices in the community who are echoing this excitement. I can’t add anything to that discussion. And besides, that’s not really where my head’s at right now.

    The official Apple content generates enough sense of FOMO as it is. Combining that with a firehose of What’s new in X blog posts, podcasts, YouTube videos, and tweets doesn’t help much as far as I am concerned.1

    It’s been an exciting week, so take a moment to collect yourself. Go on a walk. Take a hike. (Be safe about it.) Do whatever you need to break free of the “reality distortion field”. Once you do, you’ll have the necessary distance to determine what new technologies you should pay attention to and what you can ignore for now.

    Solid advice, WWDC or otherwise.


    1. I published my personal notes throughout the week, but my audience is infinitesimally tiny. Not to mention that I usually publish these things primarily for my future self.
  11. WWDC 2020: Day 4-5 Takes

    WWDC 2020 is officially over. Here are some notes based on a handful of sessions I watched in the past couple of days.

    • I am quite happy with all the WKWebView improvements that made it in this release. In particular, callAsyncJavascript will make bridging async JS and Swift a less painful affair. That said, some of these APIs, including the aforementioned, seem to be missing from the first beta.

    • Core Data didn’t get the overhaul many of us were hoping for, but it gained some useful APIs to help with batch operations. I’ll take that.

    • I am happy that we got a couple of sessions about unsafe Swift, an area that’s becoming increasingly important for those of us using Swift for server-side development (C library wrappers, database drivers, etc).

    • Speaking of server-side, it’s refreshing to see a session about using Swift on AWS Lambda. Apple has a lot of leverage when it comes to adopting Swift on the server, and sessions like these are a good sign that they are invested, at least to a certain degree, in promoting that.

  12. WWDC 2020: Day 2-3 Takes

    I’ve managed to watch most of the sessions released today and yesterday. Here are some of my personal highlights:

    • WebExtensions API support in Safari is excellent news for people building browser extensions. For those not familiar, it’s a standard way of developing cross-browser extensions, currently supported by both Mozilla and Google.

    • On the subject of Safari, several features and improvements made their way in this release. I’m particularly excited about the CSS bits, such as support for the :is() pseudo-selector, system font families, and CSS Shadow Parts—a way to allow Web Components to expose internal elements to the outside for styling purposes. Oh and WebP support.

    • As part of the Web Authentication API implementation in Safari, you can now use Face ID and Touch ID for user sign-in on your Web apps. You heard that right.

    • The new SwiftUI app life cycle is nothing short of impressive. I have been upgrading all my unreleased apps to this new API—since it’s iOS 14 only—and it’s been eye-opening to see how far this declarative approach goes in getting rid of boilerplate.

    • Contextual menus are now generalized in iOS and can be invoked from any button without requiring a long press or adding an overlay on top of the view. This is my favorite new addition to iOS this year—by far. Action sheets were always clunky to work with, and popovers felt off on the iPhone. It’s worth noting that SwiftUI doesn’t seem to have access to this new API as of this beta (Feedback: FB7776866).

  13. WWDC 2020: Day 1 Takes

    Instead of doing live reactions this year, I opted to jot down some notes during the Keynote and the State of the Union and share them in one go. So here goes nothing!

    • The home screen and springboard changes in iOS 14—App Library and Widgets—are clearly going towards adjusting the cognitive load in order to better surface the information that matters to the user at any given time. Let’s be honest, the icon grid has reached its peak usability almost a decade ago.

    • Another area that got a lot of attention in iOS 14 are the different interruptive modes in the user interface. In iOS 13 and earlier, receiving a phone call or activating Siri takes over the entire screen, making them effectively separate modes that interrupt the user flow. Starting iOS 14, these are replaced with lightweight overlays that preserve the current context.

    • App Clips are yet another aspect of evolving the app paradigm to better fit real world usage scenarios—the other two that come to mind are widgets and extensions.

    • The context preservation theme is salient in this year’s iPadOS update; not surprising given that context might be even more important on a large screen where multiple things could be happening at the same time.

    • The introduction of sidebars for in-app navigation in iPadOS 14 is another net win on the information density front. Sadly, App Library and inline widgets seem to be missing from the first beta.

    • I am very happy to see that pencil handwriting recognition works across the OS, supports Chinese characters (Kanji), and detects different languages in the same sentence. Alongside built-in translation, these are powerful new additions for language enthusiasts like myself. Update: It seems like Japanese is not supported in Beta 1. Bummer.

    • The reason Apple didn’t spend time talking about the ability to change the default browser and email client on iOS 14 is simple: most consumers couldn’t care less. If anything, antitrust regulators might be more into this one.

    • Built-in tracking control in Safari is looking to be intuitive and will likely make the current crop of content blockers obsolete; nothing beats what’s already there by default.

    • The macOS 11 Big Sur redesign is substantial. I have mixed feelings about different aspects, but I will leave that for later.

    • Control Center and the new Notification Center on Big Sur are welcome imports from iOS. The open nature of the Mac always allowed power users to devise ways to surface the information that matters to them (such as menubar apps), but for the majority of users, this is an accessibility upgrade.

    • The transition to ARM is going to be the first major architectural transition that I witness as an Apple platform developer. My main takeaway is that the timeline seems to be much more aggressive than anticipated.

  14. This Week I Learned #11

    Here are some of the things I learned this week, when I wasn’t biking or basking in the sun.

    • Why books—and other traditional methods of knowledge transmission—don’t always work (link)1. It is no coincidence that this essay resonated with me a great deal—learning is a topic that’s very near and dear to my heart. Most of the skills I use today to do my job are self-taught, and learning languages was and is still a big passion of mine. Andy expands on the idea that without additional metacognitive skills, reading books is insufficient to acquire knowledge and understanding due to the flawed transmissionist model that they are implicitly based on.2
    • Speaking of reading, I picked up the latest work of Shūzō Oshimi, わだち (chi-no-wadachi, Trail of Blood, 2017–ongoing), and I wasn’t disappointed. What starts out as a run-of-the-mill slice of life quickly spirals into an unsettling psychological thriller with some of the most nail-biting moments I’ve experienced in the format. If this sounds like something you would enjoy, give it a shot (日本語, English).

    1. I’ve had the pleasure to interact with Andy Matuschak, the author of this essay, when he used to work on UIKit at Apple. He was kind, helpful, and profusely generous with insider knowledge that helped me improve some of the articles I wrote on thoughtbot’s blog. I stumbled across his website this week and I am really looking forward to more of his work in the field of learning and cognition.
    2. As a matter of fact, “This Week I Learned” is a metacognitive tool I concocted to help me remember the new concepts, ideas, and techniques that I learn during a given week.
  15. Shipping a macOS or iOS app nowadays without a setting to match the system appearance is an increasingly harmful accessibility oversight. Discord on macOS is one of the offenders that has been consistently annoying me since earlier this summer.

    Discord appearance settings

  16. Nikita Prokopov on Syncthing

    Nikita Prokopov sharing his experience using a free and open-source alternative to Dropbox called Syncthing.

    Syncthing is everything I used to love about computers. It’s amazing how great computer products can be when they don’t need to deal with corporate bullshit, don’t have to promote a brand or to sell its users. Frankly, I almost ceased to believe it’s still possible. But it is.

    It is indeed heartwarming to see products like these still exist.1 I gave up on Dropbox long ago, and I have the same iCloud issues Nikita outlined. I am very happy to jump ship after reading this glowing review.


    1. Bonus points for being made in Sweden under a non-profit!
  17. This Week I Learned #10

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Spontaneous cognition and how random thoughts emerge from the brain (link).

    • IPFS, a peer-to-peer protocol powering a number of decentralized Internet projects. I knew about Solid and Dat, but never heard about this one, which seems to be even more popular within the decentralized Web community according to this survey.

    • NGINX has now a preview release with HTTP/3 over QUIC support. The announcement blog post has a good overview of the technology and how it’s different from its predecessors.

    # Programming

    • The Fail publisher in Swift Combine. Similar to its sibling Just, it competes immediately, but with a failure instead of a value—useful for testing and debugging the unhappy paths in your app (link).

    • Writing tests is vital for maintaining a healthy, and functional, codebase. This is less of a revelation and more of a reminder: a test I wrote while debugging a database query issue helped me discover and fix two unrelated bugs.

  18. This Week I Learned #9

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • The current chain of events unfolding across the US made me realize how much work still needs to be done in a country that prides itself on equality and justice. #BLM

    • Tools for better thinking (link). A nifty website with an assortment of techniques and frameworks to help with decision making and problem solving. The Dropbox Design blog has more on some of these models.

    • Circle packing (Wikipedia). I was introduced to the concept of packing density in business school as part of a product design and packaging workshop, but I never had the chance to take a look at the math behind it. Geometry is beautiful.

    # Programming

    • The UI on the Crew Dragon was built using Web technology running on Chromium, according to this AMA.

    • I’ve used Swift key paths here and there, but I never explored the lesser known parts of this API. This week I picked up AnyKeyPath and PartialKeyPath<Root> and used them for a server-side project I am working on (link).

    • Android phones seem to be crashing when using a particular image as a wallpaper (link). According to this Twitter thread, the issue happens during color space conversion, where the formula used to create a pixel lightness matrix rounds the color values up, resulting in a RGB sum greater than 255.1 This in turn causes an out-of-bounds exception that keeps happening every time the system UI process restarts.


    1. This formula is formally called sRGB Luma (Rec. 709). I’ve written more about it and other color lightness topics here.
  19. This Week I Learned #8

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • The difference between input and output randomness in game design (video). The gist of it that randomness that occurs before a player action is referred to as input randomness—a prominent example being procedural level generation—while randomness that occurs after user action is called output randomness, such as the case with loot boxes and success rates.

    # Programming

    • I’ve been using Markdown for years, but I never realized you could add image titles like this: ![Alt](/url/to/image.jpg "A title"). Granted, I usually avoid using the title attribute for the reasons outlined here.

    • Core Data became a lot easier to work with since the last time I used it, which was before NSPersistentContainer for those familiar with the framework.1


    1. It still feels clunky by today standards—can we have the Codable of data persistence already?