It's been a while but I used to enjoy telling folks in the early years of their career that software engineers and anarchists have a lot in common because both view "the state" as the main cause of problems.
All programming philosophies are about state
21–30 of 254 posts
Re: All programming philosophies are about state
#22Functional and declarative are the same to me
Re: All programming philosophies are about state
#23It's been a while but I used to enjoy telling folks in the early years of their career that software engineers and anarchists have a lot in common because both view "the state" as the main cause of problems.
Former long time anarchist, current long time FP proponent, presently having a laugh with you on this.
Re: All programming philosophies are about state
#24Has anyone or any PL theory in CS made a useful distinction between data and state?
Re: All programming philosophies are about state
#25They forgot Immutable! The best way to handle state.
Re: All programming philosophies are about state
#26Has anyone or any PL theory in CS made a useful distinction between data and state?
However, the existence of Universal Turing Machine (a Turing Machine that can simulate behavior of any other Turing Machine) demonstrates that data can also represent state - i.e. you can encode an arbitrary Turing Machine's state machine in the tape, without changing the Universal Turing Machine's state machine at all. That's how we got stored program computers.
In a more practical sense, a useful distinction between data and state is within the boundaries of the program - any data that is internal to your program can be considered state, while any data that you read from an external source/write to an external sink can be considered just plain data. Separating the two is a helpful technique in writing reliable software.
Re: All programming philosophies are about state
#27i want to see someone elaborate a state-maximizing, instead of state-minimizing, philosophy. lean in
Re: All programming philosophies are about state
#28It's been a while but I used to enjoy telling folks in the early years of their career that software engineers and anarchists have a lot in common because both view "the state" as the main cause of problems.
Former long time anarchist, current long time FP proponent, presently having a laugh with you on this.
Re: All programming philosophies are about state
#29They forgot Immutable! The best way to handle state.
Re: All programming philosophies are about state
#30"Functional - Modifying state is hard to get correct; keep it at the boundaries and keep logic pure so that it is easier to verify the logic is correct." My main beef with functional programming is that you essentially put the state in the "instruction pointer" and its history of walking the call stack instead of bound to symbols. It does not fit my way of thought. I personally prefer more or less statemachines.
In functional programming, we think of computation as reducing an expression; a computation is complete when it can't be reduced anymore. In imperative programming, we think of computation as updating a store of data; a computation is complete when we run out of steps to perform.
When you're partway through execution, the "rest of the program" in an imperative system is captured by the current state of the store (including the stack). In a functional program, the "rest of the program" is just the program expression itself, reduced as it has been up to this point.
I tend to like the functional model, myself, but I can see the mental appeal of keeping the program text fixed, and isolating all changes to a separate store of data.