-
Are you positive you tested positive?
If we ever hope to break out of our current pandemic isolation, we need tests to determine who has COVID-19 and who doesn’t. No test is perfect, however, which means any test is going to result in false positives, especially if you are trying to measure a very weak signal. The purpose of this post…
-
Why Use Mocks?
Testing A Simple Publisher/Subscriber System With Mockito One of the challenges I find when teaching Java testing with Mockito is that the docs, while complete, don’t motivate why you want to use mocks in the first place. This post includes a simple example to show why mocking frameworks are important and where they are useful.…
-
Antarctica Time Zones in Kotlin on GraalVM
They say you can tell someone is a developer by whispering the word “timezone” in their ear and watching a shudder go down their spine. Here, from Wikipedia, is a picture of the time zones in Antarctica. Amazing, right? But the funny part isn’t immediately obvious. See how the South Pole is inside that hashed…
-
A Few Astronomical Examples in Kotlin
The website Open Notify provides a few URLs that return JSON data from NASA. There are currently three links supported: Number of people in space Current location of the International Space Station Overhead pass predictions for the ISS Just for fun, this blog post uses Kotlin to access each one, transform the results in Kotlin…
-
Fibonacci in Kotlin
I didn’t realize it until I noticed the trending topic on Twitter, but Saturday, November 23 was Fibonacci Day. That gave me an opportunity to drag out one of my favorite old jokes: For those unaware or who don’t remember, the Fibonacci series starts with 0 and 1, and then each subsequent number is the…
-
Annotated TOC for Kotlin Cookbook
Last week I received an email asking about a table Of contents for my new Kotlin Cookbook, saying they couldn’t find one either on the O’Reilly Media site or on Amazon. It’s a lot easier to make a decision about buying a recipe book if you have a list of recipes. When I checked last…
-
Kotlin Palindrome Checker
This post, based on code from my new Kotlin Cookbook, shows how to write a palindrome checker in Kotlin. Along the way it discusses raw strings and regular expressions, writing functions as single statements, and creating an extension function on String. First, a quick definition. A palindrome is a string whose characters are the same…
-
A Deep Dive into the KotlinVersion Class
Getting the current Kotlin version is easy, but the actual KotlinVersion class is much more interesting. This post shows how to get the Kotlin version programmatically, but then looks at the details of the KotlinVersion class, including how it demonstrates a great way to write an equals method and more. Note that this demo is…
-
Java 11 HttpClient, Gson, Gradle, and Modularization
This post describes a simple system that uses the new HttpClient class that comes with Java 11 to access a RESTful web service. After demonstrating basic functionality, changes are made to parse the results using Gson, and even modularize the code and have it work with Gradle. The goal is to provide an example for…
-
Managing Your Manager: The Video Course
I’m a regular speaker on the No Fluff, Just Stuff tour (I’m now entering my ninth year, which I can hardly believe), and one of the talks I’ve given there for many years is called “Managing Your Manager”. It’s been one of my most successful talks, and I’ve given several versions of it, including as…