Never miss a beat

Join my newsletter.

The Archives

Formatter Objects: Testable Fragments

Published: 1/24/2019

Let’s face it — Fragments are a pain to test and it’s predominantly due to how the Android operating system works. Sometimes, you’ll find yourself writing business rules regarding how a view is displayed. Likely, some data will come back from a web server and you’ll have to format some text differently or color something differently. Nothing crazy, but all this code adds up and needs to be tested. Ideally, you’ll have some form of automation coverage to help tackle this problem, but Espresso…

The Facade Pattern for Simple Dependency Injection

Published: 1/16/2019

I’ve been working on a Ktor api for a while now and found myself needing to make sure my routes had access to my repositories. Naturally, I sought out the advice of anyone who’s implemented Dagger with Ktor. After digging for a bit, I realized that it was completely unnecessary and likely overkill. Dagger works great on Android because you are tied to the constraints of the platform and lifecycles, but with Ktor I have control of the entire scope of my application. So I considered trying…

What you need to know about the Gilded Rose interview problem

Published: 1/16/2019

A few years ago, I interviewed for a Dev Ops position at a pretty prominent CI shop in San Francisco. Part of the interview process involved a take-home code-assignment (of course). This particular assignment is known as the Gilded Rose. The Gilded Rose isn’t a fizzbuzz. It’s not “Implement a Trie” in whatever language you want. The Gilded Rose is a problem that involves adding some functionality into the worst code that a developer could ever write. I don’t mean any offense to whoever created…

Controllers in Ktor

Published: 1/10/2019

Ktor is a microframework written in Kotlin. It’s focus is on building asynchronous servers and clients in connected systems. I’ve been using it predominantly for the “server” slice of that statement. I call Ktor a “microframework” simply because, while it’s opinionated, you have a lot of freedom in the way that you accomplish tasks within the framework. If you’d like to follow along, you can scaffold out a basic Ktor project via Intellij Idea or the online tool for generating a seed project…

Lambda-Map Performance in Kotlin

Published: 11/19/2018

Working on an enterprise application written in Kotlin, I’ve recently noticed something that felt “off” to me. Perhaps you’ve seen it, perhaps you’ve written it — maybe even recently! It looks something like this (I call this a Lambda-Map): Sure, this plusOne function isn’t really necessary. We can just inline it in the Lambda, but imagine for just a moment that this function does much, much more than just add one to a number. It then feels just to have that code pulled out into a private…

Introducing KotlinToday.com

Published: 11/13/2018

When I was learning Clojure for the first time, I had two references that I found myself reading every single day . The first resource is a fantastic guide by Daniel Higginbotham called Clojure for the Brave and True . The second resource that I found myself using allowed me to immerse myself into the Clojure community and figure out where people were focusing their efforts – Planet Clojure . Planet Clojure is a metablog that pulls in blog posts from a vetted list of Clojure developers. In…