It's about where outputs come from. In a Moore machine, outputs are a function of the current state only, e.g. "while in the HEATING state, the heater output is on," regardless of how you got there. In a Mealy machine, outputs depend on the current state and the input/transition, e.g. "on receiving an ACK while in the WAITING state, send the next packet," so the output is associated with the transition, not the state. Practically, Moore machines tend to be easier to reason about and give glitch-free outputs (output changes only on state entry), while Mealy machines can react in the same cycle as the input and often need fewer states. Most real firmware machines are a pragmatic mix, some outputs tied to states, some to transitions. The distinction matters mostly for clarity, for matching diagram conventions, and in hardware/HDL where output timing is critical.
Data Structures & Algorithms · Interview question
What's the difference between a Moore and a Mealy machine?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Finite State Machines
One state at a time, transitions on events: the structure behind protocol parsers, button debouncers, and comms stacks, implemented as a switch or a transition table.