Issue #62
Hi there, welcome to the first issue of 2024!
I hope you had wonderful holidays, and are ready for the new year. Let's remember to have a balance between work, fun, and rest ๐งโ๐ป๐ณ๐๏ธ
We passed 3000 subscribers over the holidays, a warm welcome to everyone who just joined ๐ I'm grateful to y'all loyal subscribers for being along with the ride ๐
Let's dive into some learnings ๐คฟ
Try Setapp for free
Naming unit tests
When a test fails, we want to understand what broke. When a name is descriptive, we can get the gist of what broke without reading the test code. It's especially useful when a test failure happens on CI. Jon describes a good formula for naming the tests:
[UI]Image memory footprint
Memory usage โ file size.
"Memory use is related to the dimensions of the image, not the file size." - Session 416, WWDC 2018
To reduce our app's memory footprint and reduce chances of the app being killed in the background, we can:
- make sure there are no memory leaks (in UIKit, views deallocate). Use Debug Navigator (spraypaint icon in Xcode) and Leaks and Allocation instruments.
- downsample images to view size before display (an image larger than its frame uses memory unnecessarily). See the article for how to do it.
- when an image cache library is used, remember to set the memory cache limit.
Typestate pattern: next-level type safety
The concept of typestates describes the encoding of information about the current state of an object into the type of that object. I'm a big proponent of using the type system to apply domain constraints, so the compiler checks that logic for us.
In this article you can learn how generics and noncopyable types available from Swift 5.9 help take type safety to another level:
What game are you playing in life?
We are in the beginning of a new year, perfect time to reflect.
Imagine your career as a game. What game is that? What are the objectives? What level are you at, and what quest do you need to complete to advance to the next level? I'm curious to hear in replies what that is for you โบ๏ธ
New video alert
I visited The Mayank Show to share my insights on becoming a lead developer. We talked about boosting your career, moving abroad, system design, mentoring, running a newsletter, conferences, and what's different between 2011 and now ๐
โ๏ธ
Alright, that's it for today! Let's spread the good code vibes โจ๐ง๐โ๏ธ
I'm curious if you found any of the tips particularly interesting - let me know by replying to this email!
* this issue contains an affiliate link to Setapp
Member discussion