View profile

SpookilyTyped 🎃

StoicallyTyped Newsletter
Happy October, the month of spooks and sweets!
Halloween is my favorite holiday and we will be celebrating all month long! For this month only we will deviate from out stoic roots into spooky fun and facts.
Also in this issue is a recap from Friday’s Twitter Space, some fun tricks, followed by cool treats.
Read on and enjoy…if you dare 😈

👾 Fun Stuff
Ivan Morgillo 🐕💻⚔️☮️❄️🧘🏻‍♂️
How to properly communicate danger to your teammates?

Use this annotation on your classes:
@HereBeDragons
https://t.co/3zk3WBxPO6
The official WCA scramble server
🟣 Space Recap: Android Dev Hang
This week we spoke with Py from Square and heard about the new logcat library! Py gave some excellent explanations and discussions into the decisions behind logcat. I’ll outline them below in a Question/Answer format:
Q: What are some challenges that are faced with logging at scale?
  • A: Scale can mean many things so in this case we’ll consider it as many engineers and many lines of code. There needs to be a way to handle logging in debug and release builds. Its not usually useful in release builds so logcat helps with this in a performant way. No need for if (DEBUG) { Log.d() }
  • There can also be some performance improvements. Timber captures a stacktrace to figure out the tag of the log and this was happening in production. logcat uses lambdas to evaluate only when needed.
Q: What are some benefits to using logcat?
  • A: You can use Kotlin’s String interpolation for your logs! Much nicer than needing to use formatted Strings.
Q: Because of the lambda approach to logging are there any problems with issue reproduction because a debug builds will have different code paths than a release build?
  • A: Yes there is an impact to logging but we don’t dynamically handle logging for different contexts. We could have logging on all the time to have the same code paths. We are generally okay with having a bit more lag in a debug build.
  • However, this is interesting because with logcat using lambdas we could evaluate how long lambdas take to run and then call out any lambdas that take longer to run than expected.
Q: How is tagging handled?
  • A: It’s a bit of a hack but it’s pretty cool. I made logcat an extension on Any and therefore have access to this. Then I can call this::class.java.name to get the class name! It’s not perfect because sometimes you won’t have a this and sometimes your this might not be a class in different contexts, but it should work for most cases. In cases where it doesn’t work you can supply your own tag as a parameter.
  • We are looking into what a Kotlin Compiler plugin would look like for this and be able to get even more information for the tag here.
Q: What happens if you log from a background thread? Does this cause any memory issues?
  • A: It shouldn’t cause any memory issues. Its always a final reference so this will never change on different threads.
Q: One of my favorite features from Timber is being able to plant different trees to log to different services, is this something that is supported in logcat?
  • A: Yes and no. Yes you can do this but we don’t really want you to.
  • Yes you can do that because you can set one logger that would delegate to whatever.
  • No because we really just want this to log to Android’s Logcat. When you add this feature logging at scale can become tricky because people start forgetting the rules. What logger will log to what? I recommend having different APIs for logging to where you want to log. This way it is explicit where your logs will end up.
Q: Why was log priority removed?
  • A: Most engineers just want to log to debug so why make it required? If you want to log to something else then you can use the priority parameter.
Q: Why was Throwable removed from the supported parameters?
  • A: I never remember the order of the parameters. So to make logging easier there is an extension function Throwable.asLog() and you no longer need to think about which function to use.
Q: Is there any future plans for Kotlin Multiplatform compatibility?
  • A: Not really, but not against it. The name wouldn’t really make much since because there is a chance it wont run on Android!
Q: What’s coming next from you Py?
  • A: I’m primarily focused on performance right now and I have a bunch of articles written about it. There’s also a new library from Google for performance coming soon that can be found in the source and I’m looking into to see if it’s something that can help measure jank.
📚 TL;DRs
🛠 For Your Toolkit
The Jetpack Compose Internals Book by Jorge Castillo 🍋
👩🏾‍💻 Android Practice Question
  • What are extension functions?
  • When should they be used?
  • Do you know of any cool examples?
Send a link to a gist with your answer by replying to this email or the Tweet of this issue. Have your answer included in next weeks issue!
⭐️ Answer to Last Week's Question
What are some good ways to write meaningful commit messages?
There are so many tips to share here and some of them can be decided by you and your team but here are some of my favorites:
  • Include the ticket number you are working on. This is helpful for looking back through your commits and seeing more context into why a change happened.
  • Write a short summary line, and separate it from the details with a newline.
  • Write details for the change. This will make the commit easy to understand when viewed, but also provide additional info when needed.
  • Be sure to explain why some code was changed not how it was changed.
This post has some more cool tips!
🎃 SpookilyTyped
Way back in 2013, when micro-USB was king and Android releases were named after sweets, we were given the gift of Android KitKat.
The release of Android 4.4 KitKat included promotion with the makers of KitKat. Buying a KitKat with the below packaging gave you to opportunity to win a Nexus 7 or some Google Play credits!
I remember getting a few KitKats during this time and getting multiple $5 credits! Unfortunately only one could be redeemed per account. This spawned some generosity with the Android community on Reddit where people shared their extra codes with others!
Check out some of the links below to take a walk down memory lane!
Kitkat 4.4
Android – 4.4 KitKat
Android KITKAT 4.4 - The future of confectionery
Android KITKAT 4.4 - The future of confectionery
👋 Want to Contribute!?
Did I miss something spooky this week? Have a question you want answered by the community? Send them to me on Twitter or reply to this email. I’d love to hear from you and chat!
If you enjoyed this issue send it to someone you think might enjoy it.
Remember to stay sweet and have a great week!
Thanks for reading!
- Matt 👻
Don’t miss out on the other issues by Matt McKenna
Did you enjoy this issue? Yes No
Matt McKenna
Matt McKenna @himattm

Develop a thoughtful approach to software engineering.
Focused on Android, applicable to all.

You can manage your subscription here.
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.