1 min readJun 16, 2020
Good and clear names help, good API design helps even better. E.g. if an invalid order identifier is not a logic error in your particular code, but something that a caller code must handle, then don’t use updateOrder(orderId: String, ...)
API design in the first place, but design a separate findOrderById(id: String): Order?
function that clearly requires caller to do something with the null
result, and then have updateOrder(order: Order,...)
which cannot be called with invalid order in the first place.