Code Room
Code reviewHardcr-g266
Subject Short circuit evaluationLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java order pipeline. `tryReserve` performs a network call and returns whether an inventory hold succeeded; `tryCharge` actually moves money.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
boolean process(Order o) {    // Reserve stock first, then charge the customer.    boolean ok = inventory.tryReserve(o) & payments.tryCharge(o);    if (ok) {        fulfillment.enqueue(o);        log.info("order {} placed", o.id());    } else {        log.warn("order {} failed", o.id());    }    return ok;}
Run or narrate your approach, then ask the coach.