Issue 16: Testing, Reading, and Time to Do It All
Happy July, and welcome to another edition of my newsletter! Here I share things I’ve read recently, updates on what I’ve been working on, and occasionally nascent blog post drafts.
What I’m Working On
Work on Ergo has progressed well, and I’ve finished up enough integration tests to feel confident going forward with actual development again.
A few thoughts from the testing work that has made it much easier:
- Each test creates an entirely new database, so there’s no need to manage state between tests. This pattern comes from the book Zero to Production in Rust.
- A lot of the tests have permissions aspects to it – users with certain permissions can do certain things, and users without those permissions should not be able to. With a single function to create a new user, it’s easy to write these tests.
- Each user has an attached client that autofills an API key linked to the user, and this client is returned from the function that creates the user. This means that I don’t have to think about how to create requests for each user – I can just call
user1.client.write_task(..)
. - The HTTP client for the tests has a function for each API endpoint, and converts responses to the expected Rust type for the endpoint. This oh makes inspecting return types easier and ensures that the API endpoints are returning the expected types.
I also put out a new blog post this week on Streaming S3 Uploads in Rust, talking about the buffer management involved and with some code examples. This one got a bit of attention and even an erratum report from a helpful reader, so that was nice.
Reading
Simple Anomaly Detection Using Plain SQL is a good introduction to using standard deviations and other simple statistical practices to perform anomaly detection. It discusses implementing the queries, how you might set the thresholds of what constitutes an anomaly, and other useful topics.
Andy Weir’s new book Hail Mary came out recently and it was brilliant. If you liked The Martian, you’ll love this book. It has much the same feel, but with higher stakes and more ambitious science. A joy to read, beginning to end.
I also spent a few days reading the first half of Ashlee Vance’s biography of Elon Musk. I think this first half gave me a pretty good idea of Musk, and so I opted not to finish the book. A few takeaways:
- Musk was interested in things like solar panels and space travel from early ages.
- He is prone to exaggerating progress, but this tendency is backed up by Musk being one of the most determined people ever, and a lot of his success is a result of that.
- This determination feeds into his interaction with employees, and can lead to harsh interactions.
- But when things go really wrong, Musk is right there as a teammate, the first one to encourage them to keep going.
There’s some about his personal life in there too which I won’t get into, but it doesn’t paint him in a positive life. Overall an interesting book, and while it came out in 2015 it gave me the idea that his antics over the past few years aren’t actually so out-of-character.
Other Thoughts
My free time is limited due to two small kids in the house, but I try to do some combination of working on side projects, reading, and writing when I can. This had lead to some frustration as night time tends to be full of interruptions, and frequently there isn’t the time to really get into good focus for coding.
So, I recently have moved my side project time to the mornings, and have relegated nights for reading and writing. This has turned out to be good on three axes: I’m doing a lot more reading and writing, making a lot more progress on my side project, and since reading and writing are more friendly to interruptions, I’m happier at night too.
I know not everyone can make these sorts of schedules due to other constraints, but if you are able to set aside time like this, I highly recommend it.
If you enjoyed this, I’d love if you share it with a friend (sign up here) or just reply to this email with your thoughts. Thanks for reading!