Discussion about this post

User's avatar
Neural Foundry's avatar

The sealed result types approach is genuinly clean. Forcing the compiler to handle every case with exhaustive pattern matching eliminates that whole category of runtime surprises where an edge case slips through. I've definetly spent too much time debugging mocked service layers, so the static functions + active record model is refreshing. Only concern is whether the panache pattern scales when you need more sophisticated query building or complex transaction boundaries.

Morten Hindsholm's avatar

I really like this approach but I don't see how you can avoid mocking.

The test you sketch out:

```

var result = OrderOperations.placeOrder(request);

assertInstanceOf(OutOfStock.class, result);

```

will AFAIK require some mocking of the OrderOperations class or did I miss something?

5 more comments...

No posts

Ready for more?