On Mon, Aug 12, 2013 at 9:45 PM, damodar kulkarni <kdamodar2000@gmail.com> wrote:

Curiously, whenever I use state, my programs start to become similarly brittle. There is no reason why state should be a fundamental element of a programming language, and as a design pattern, state is best avoided at all cost.

Just as a curiosity, how would one avoid state in cases like protocol design? e.g. protocols specifications (like TCP/IP) do have a large element of state dependent behavior that "seems essential" to the problem. How would one deal with such cases?


State can be achieved in pure functional languages. The difference is that the state management is not directly accessible to the programmer as it is hidden behind a highly declarative set of abstractions. This provides the benefits of consistency, and sometimes frustration when the resulting machine code doesn't perform as expected.

Cheers,
Darren