Building on the Wrong Abstraction

Writing sturdy software is hard work. Sometimes it’s very hard work, but it doesn’t need to be. Very Hard Problem: ORMI have a confession: I like Hibernate. The @Version feature is my favorite; it makes optimistic locking easy and safe. I also like how simple it is to…

Many Correct Answers

Let’s copy a file with bad Java I/O: private void copy(File source, File target) throws IOException { try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) { while (true) { int b = in.read(); if (b == -1) break; out.write(b); } } } Whoops, it’s super slow. Reading a…

Optimizing ‘new byte[]’

How much time does it take to allocate a byte array? Let’s write a JMH benchmark: @Param({"1000", "10000", "100000"}) int size; @Benchmark public void newByteArray() { byte[] bytes = new byte[size]; bytes[bytes.length - 1] = 'a'; }Running this on my laptop shows that time scales with size: size…

My Best Money Advice

Managing money is work. In addition to the global meltdown that’s going on I must continuously optimize my cost of living, make sure I’m earning enough, avoid taxes, save for retirement, and donate generously. Plus the mild anxiety of whether I should keep HBO and Netflix and Disney+…

Bright Lines

I’m often working on some kind of self-improvement: changing my diet, exercising right, or adjusting my work-life balance. But changing my behavior is difficult and I had many failures before any successes. In 2012 I tried to reduce the amount of meat in my diet, from 1-2 times per…

X.509 Certificates in Kotlin

I learned most of what I know about TLS certificates through reading APIs, source code, and specs. My instincts from dealing with ASN.1, X.509, and TLS as a user is that it the APIs are complex, and I should stay away️ from the even more complex implementations. But…

Christmas Breaks

Deploying early & often is addictive. Frequent deploys make it easier to identify regressions, tighten feedback loops, and get fixes to customers sooner. So I’m happy that the Cash App team has tests & tools for frequent deploys. All this deploying has a catch: we don’t notice slow…

Synonyms are Bad

I’ve been working on TLS lately. The specs, the APIs, and even the docs make me feel dumb. Why is this so hard?! I struggle when it takes 2 hours to do something that should take 20 minutes. One thing that makes TLS difficult is the jargon and acronyms.…