A Sudden Tern
by in CodeSOD on 2026-01-15Matthias sends us what he calls the "tern of the century". Which, before I share it with you: bad news, it's just a regular bad ternary. But it remains bad in interesting ways, so it's definitely worth talking about. But let's not oversell it.
private static String getOrderTypeCode(CreateOrderRequest order) {
return !StringUtils.isBlank(order.getOrderParams().getReceivingCompanyFoo()) && ORDR_TP_DQQ_FOO.equals(order.getOrderParams().getOrderType()) ? ORDR_TP_DQQ_BAR_CDE : order.GetOrderParams().getOrderType().getOrderTypeCode();
}