Saturday, January 31, 2026

How to Fix NPEs forever

Null is biggest flaw of Java, saying some developers. Null causes NPEs causes crashing software. IMHO this is the same vibe as C vs Rust and I totally disagree. Crashing software is caused by developers and not by the programming language.

The easiest and best way to prevent NPEs is … proper exception handling. It is as simple as it sounds.

Bye the way, NPEs are often a side effect of OOP. All Objects are unsafe until you checked them. But checks are unsafe so go with exception handling.

 


 

Saturday, January 24, 2026

Increase resilience: Decouple external system calls

For most software companies resilience means that the replication factor is 2 or higher.

 

Well that's far from good. You resilience is still bad as with two instances of your weak micro service. 

One way to increase the internal resilience of your service is to decouple external service calls. This  includes Data Base operations, Kafka, HTTP. For HTTP calls it is very common and most developer understand that this HTTP calls can go wrong but Data Base calls, yes all external services are running over a network, firewall, load balancer, switches, ... So it's a good idea to make all external call more resilient:

  1. Put the external calls into own treads. This keeps your application running in case of an error or time out.
  2. And have a time out or watchdog on it. By the way, Java futures are a easy way to do it.
  3. Check the results also for write operations. 
  4. Extend logs and monitoring to recognize external call errors.