4 ms·
My take on this is that computation is the act of describing different states that the processor can be in - or describing the path from one state to the next.
by sjclemmy 10y ago
My take on this is that computation is the act of describing different states that the processor can be in - or describing the path from one state to the next.
I think an understanding of state is fundamental - one thing that brought this home to me was a talk I watched given by Sophie Wilson [https://en.m.wikipedia.org/wiki/Sophie_Wilson https://en.m.wikipedia.org/wiki/Sophie_Wilson] in which she displayed an image of a cpu. The image showed a 'path' across the cpu that was the current state, the next image showed a different path describing a different state. The path was a lot like a bolt of lightening.
An understanding of functional programming (FP) matches this a bit more directly than OO as FP is a pipeline of functions that describes state change and it is easy to reason about the state at any point in the pipeline. OO represents a real world object so you are encouraged to think about the problem you are modelling rather than the how to represent different states. But obviously in the end they both describe state and logic that describes state transition.
- chillacy 10y agoNeat take on it. Finite state machines tend to be very robust since the designer has to lay out all the state transitions beforehand. Everything else is all combinational logic. Bad OO tends to have state spread out everywhere, but even good OO usually won't be so strict about state.
- sjclemmy 10y agoYeah - I think FP forces you to think about state and state transition while OO forces you to think about your abstraction and modelling. So if you do OO without consideration of what's going to happen next - the compilation and what the computer is actually doing, i.e. moving from state to state, then it's easier to make bad design decisions.