← Bloomberg Interview Insights

Bloomberg·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Bloomberg SWE interview with a meaty API design question that was more involved than I expected. The problem looked like a simple buffering exercise but kept expanding the more they probed.

Questions Asked (1)

Q1

Design a PacketAssembler API that accepts streaming byte fragments and emits a completed payload once the expected number of bytes have been received. The first fragment carries a header byte indicating the total payload size. Walk through class and method signatures, how you manage internal state, behavior across consecutive packets, error handling for bad headers or oversized input, whether state resets after emitting, and thread-safety.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

I started with the happy path and it went fine, but then they asked about consecutive packets and I fumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the public API with clear method signatures, then walk through the internal state machine and error handling. Emphasize edge cases like consecutive packets, oversized input, and thread-safety, and justify design choices with trade-offs.

Pro tip: Explicitly discuss how you would test the assembler, including unit tests for boundary conditions and concurrency tests, to demonstrate production readiness and attention to detail.

1. Clarify Requirements and Assumptions

Ask about expected fragment sizes, maximum payload size, threading model, and error reporting preferences to scope the design.

2. Define Public API

Specify class name, constructor, and methods (e.g., feed(byte[] fragment) returning Optional<byte[]> or throwing exceptions) with clear contracts.

3. Describe Internal State and Lifecycle

Explain fields (buffer, expectedSize, bytesReceived), how state transitions from expecting header to accumulating payload, and reset behavior after emission.

4. Handle Errors and Edge Cases

Detail validation for header (e.g., size > 0, within max limit), behavior for oversized fragments, and how to signal errors (exceptions vs. error states).

5. Address Concurrency and Testing

Discuss thread-safety (synchronization or thread confinement) and outline test cases for normal flow, errors, and concurrent access.

Key Points to Mention

  • State machine: header byte indicates total payload size; subsequent fragments fill buffer until complete.
  • Buffer management: use a dynamically sized buffer (e.g., ByteArrayOutputStream) or pre-allocate based on header.
  • Error handling: throw IllegalArgumentException for invalid header (e.g., size <= 0 or > max), and handle oversized fragments by either rejecting or splitting.
  • Reset semantics: after emitting a payload, reset state to expect a new header; consider if partial packets should be discarded on error.
  • Thread-safety: make feed method synchronized or use locks; discuss trade-offs of blocking vs. non-blocking.
  • API design: return type (Optional<byte[]> vs. callback) and how to handle multiple packets in one fragment (if allowed).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.