Code Room
Code reviewMediumcr-g135
Subject Inconsistent errorsLevel Mid–Senior~22 minCommon in Databases & SQL interviewsIndustries Software development

Question

Review this Java Spring REST controller.

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
@PostMapping("/orders")public ResponseEntity<?> create(@RequestBody OrderDto dto) {    if (dto.getItems().isEmpty()) {        return ResponseEntity.badRequest().body("items required");    }    try {        Order o = orderService.place(dto);        return ResponseEntity.ok(o);    } catch (Exception e) {        return ResponseEntity.status(500)            .body(e.getMessage());    }}
Run or narrate your approach, then ask the coach.