Toehold Test

Let’s write a small class that has potential to grow. data class ZipCode(val code: String) { init { require(code.matches(Regex("""\d{5}"""))) { "not a zip code: $code" } } } Should you write a unit test for this? Turbo test-driven developers do because…

Deadlines

My recent work requires coordinating teams to build their own pieces of a larger puzzle. We’re going to replace old system 𝒂 with new systems 𝔁, 𝔂, and 𝒛, and that means each team needs to land their contribution on schedule. But in my heart I know that software hates schedules! We’re…

Live Forever

I don’t have a fountain of youth but instead a surprising approximation. You know the expression, “time flies while you’re having fun?” It’s almost right. Your brain’s perception of time flies when you’re doing something familiar. And most importantly, your perception of time slows when…

Weightloss

If you lose 10 pounds, where do those pounds go? It’s weird trivia that I never learned in school. Do you poop it out? pee? sweat? A parallel question clarifies: where does the gasoline goes when you drive your car? The car’s internal combustion engine turns oxygen and…

SQL Multiple-Column IN Clause

The IN clause is handy. I use it all of the time. SELECT * FROM cars WHERE make IN ('Ford', 'Subaru') AND price < 5000; +--------+---------+------+--------+-------+ | make | model | year | color | price | +--------+---------+------+--------+-------+ | Ford | Focus | 2007 | Black | 1100 | | Ford | Mustang | 2005 | Yellow | 4000 | | Ford…

Developer Identity & Multiplatform

We don’t self-identify as software developers but as web developers, backend developers, Android developers, or iOS developers. Many factors reinforce this specialization. I’m a Droid Building systems builds experience. Android developers learn technologies that have no analog on other platforms: activities, intents, and XML layouts. Once we’ve…

URL Encoding Is Material

Lots of OkHttp and Retrofit users have reported bugs complaining that URL special characters (like + ; | = * ; ; | or *) weren’t encoded as they expected. Why can’t HttpUrl just encode ; as %3B? Extra escaping is safe in most programming languages and document formats. For example, in HTML there’s no behavior consequence…

A Clever, Flawed OkHttp Interceptor Hack

All of OkHttp’s configuration is on the OkHttpClient instance: OkHttpClient client = new OkHttpClient.Builder() .readTimeout(2_000, TimeUnit.MILLISECONDS) .writeTimeout(2_000, TimeUnit.MILLISECONDS) .cache(new Cache(cacheDirectory, cacheSize)) .build(); This design is minimal and simple. There aren’t any precedence rules or hidden settings to be surprised by.…