principles_of_developing_robust_applications

# Principles of developing robust applications

Kotlin edition

[TOC levels=2-6]

## Making illegal state unrepresentable

### Union types

### Validate at the boundary

### Null handling

### Enumerating all cases

### Specific types with value classes

## Exceptions and how to handle them

## Logging

Log as little as possible and as much as necessary.

Messages should have enough context to be valuable. This means if you read a log message it should be useful. Who did what, when and where.

"Document updated" is less useful than: "User A updated document D, changing the title from Y to Z."

Different log levels:

* verbose: Use this to print raw input / output streams.
* debug: Provide context that is useful for debugging, i.e. making internal state visible.
* info: Use this to log actions that were done purposefully
* warning: Use this for errors that can be recovered from.
* error: Use this for unrecoverable errors.

## Memory usage




edited by: stefs at Friday, October 17, 2025, 12:57:44 PM Coordinated Universal Time


view