I’m reading TDD By Example by Kent Beck right now and one of the Red Bar Patterns really resonated with me. It’s called the Learning Test. Here’s the scenario. You have a new library or framework that you’re implementing. Instead of just diving into TDD’ing the implementation, you can write some learning tests. These are tests where you validate how you expect the 3rd party tool to work for you. I see this as testing the contract between your application and the 3rd party tool.
Today I learned a little bit more about how pointers work in Go. We had this object that we want other functions to directly modify. So we pass a pointer to this object to various functions and then in our tests we check to see that the original object has been modified correctly. We also have these helper functions that are supposed to return a pointer to an object buried inside of the struct.
I’m developing my own budgeting app using Go and have been using it to learn new things as well. For testing, because I’m TDD’ing the entire project, I decided to just use the built-in Go testing framework. I use Ginkgo at work and enjoy it, but decided to see what vanilla testing in Go is like. After writing a bunch of tests for a lot of my boilerplate functions, I quickly had a lot of duplicated set-up code that looked like this at the start of all my tests:
This year, I decided to participate in my company’s halloween contest. My Instagram news feed usually has a few cosplayers on there, and they started inspiring me to try and build a costume of my own. First I thought of dressing as Geralt from the Witcher, since I’m still in the middle of playing Witcher 3. All the sewing and fabric cutting got me a bit nervous though. Then I came across a video of a cosplayer showing how she built armour and she made it look SO easy!
Sometimes you want to modify some of the defaults that appear in the chooser, like when you’re sharing a text or image to any other android app that can accept text or images. The most common use case for this is when users press the “Share” button in your app. To create the custom chooser, you use the ShareCompat.IntentBuilder class. String title = "Share weather details"; String mimeType = "text/plain"; String shareText = "I want to share this string"; Intent intent = ShareCompat.
An image is worth a 1000 words. Source That image generally sums up the main beats of the Android Activity lifecycle. Knowing the lifecycle allows you to think about what your application should do as it goes through this lifecycle. What information you need to save to ensure the user has a consistent experience? I’d really like to see how Twitter handles the lifecycle on it’s timeline activity. I admire how well, even when the app crashes, it’s able to maintain the exact position I was in on my twitter feed.