View profile

 iOS Code Review | Curated code improvement tips - Issue #30

 iOS Code Review
 iOS Code Review
Hi there,
I hope the summer is treating you well, and you’re progressing toward your goal, whatever it is!
As promised in the last issue, here’s me sharing behind-the-scenes on how I make the newsletter issues: https://youtu.be/CgTqqkzeeh8
Let’s dive in 👇

On push notifications
Last week Airbnb accidentally sent a test push notification to real users. Sarun has a good point - it’s not a good idea to use inappropriate words in text that could be seen by users. This applies to everything - not just push text, but also in code that shouldn’t theoretically be executed in non-debug builds.
Sarun W.
One tip I can share about today's @Airbnb incident.

Don't use curse/inappropriate words in user-facing features even when you test.

The situation can be much worse if you do. https://t.co/IlMA2vkIC7
The sum effort
This simple formula Jane shared really put things in perspective for me.
Also it brought me to realise: if someone put effort into making the code more readable and well-structured, then it’s less effort to read / work with later. If someone wrote “bad code” - perhaps spent less effort writing it - it takes extra effort to read later. Either way, the sum of total effort can be the same. No easy way out, the effort has to be spent by someone at some point, always.
Better equality test failures
If you’ve ever seen a test failure like this and hated it, Difference is a package that can help. It offers a diff function that returns a readable explanation of what exactly is different. The doc for the library includes examples of how to easily use this with XCTest, Quick, and Composable Architecture.
GitHub - krzysztofzablocki/Difference
REST API
If you ever wondered what’s the difference between just API and REST API, here’s a short, digestible writeup about it:
RapidAPI
What makes an API a REST API?

A thread 🧵
On code duplication
The problem of duplication is more nuanced than it seems. Common advice such as “duplication is cheaper than the wrong abstraction” is often based on the simplified view of the problem, that it’s just about code. In this article @JasonSwett looks at what duplication actually is, why it’s such a surprisingly complicated problem, and what can be done to address it. Thanks @ctietze for sharing the post!
We could imagine that duplication could be defined as a piece of code that appears in two or more places. Indeed, this sounds like a very reasonable and accurate definition. But it’s actually wrong!
Here’s what duplication really is. Duplication is when there’s a single behavior that’s specified in two or more places.
Duplication - Code with Jason
🤘
Alright, that’s it for today. 
Did you enjoy this issue? Let me know by pressing the buttons below. If you enjoyed it, you can help grow the newsletter by spreading the word ☺️
Got feedback? Want to see more, or less of certain kinds of tips? I’d love to hear from you. Reply to this email or reach out on Twitter via @ios_code_review 🙌
Did you enjoy this issue? Yes No
 iOS Code Review
 iOS Code Review @ios_code_review

Bi-weekly newsletter amplifying code improvement tips from the Apple developer community in a bite-sized format. Swift, Objective-C, iOS, macOS, SwiftUI, UIKit and more. Curated by Marina Gornostaeva and published every other Thursday.

For feedback or sponsorship ->> [email protected]

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.