Languages and automata, part 2

suidou

Today an oppressive, passivizing heat covers Tokyoites like a massive woollen blanket. Summer is here. In a feeble attempt to defy the heat, I follow up on my previous post on languages and automata.

That post ended with the suggestion that we can apply these concepts to interactions in society. But can we? As a starting point, let’s think about stateless and stateful interactions in a system. Stateful interactions involve a change of state, in some sense. Stateless interactions involve no such change. What counts as stateful depends very much on how detailed the model is – these might be examples:

  • You make a purchase in a convenience store – the obvious changes of state are the balance in your wallet/bank account, the amount of items you possess/carry with you, and the corresponding opposite changes on behalf of the store.
  • You greet somebody you know on the street and exchange some small talk. Even though no actionable information is exchanged, you both feel happier afterwards and in a better mood because you were acknowledged by someone else. This is a change of state. The precondition is that you are in a state where you know the other person – this interaction would not be possible with a random person in a random state. (On a different level, a typical such exchange goes through at least three discrete states in itself – “greeting”, “exchange of information”, “goodbye”).
  • You go to your job in an office, read some documents, write some reports and leave. We can think about the wear and tear on the furniture and the building, the carbon dioxide-oxygen exchange in the air, and the changes to your company’s total body of information as changes of state. Which to choose depends, again, on the model.

Are there any stateless interactions then? Within the context of a particular model, yes. If we only care about monetary and material transactions, the meeting on the street might be stateless. If we only care about “mood” states, the purchase in the store might be stateless, and the office job might have a negative effect on accumulated mood.

In software engineering, we always try to hide state as much as possible. State makes the system far harder to understand and reason about.  We like immutable objects, whose state never change. If we look at reality through abstractions, maybe such things can exist, but in the physical world I don’t believe they do (I’d have to ask a physicist to know the answer though).

The most complex interactions in society, I think, take place among people and organisations that have long lasting relationships. These entities can modify each other’s state over a long period of time. If I’ve known somebody for years, there’s a very large number of possible states a conversation with that person might be in, a large number of topics I might possibly bring up and discuss. But the limitations of societal norms and my own knowledge imply that a conversation with a stranger might be a very small state machine indeed. (On the other hand, maybe this is why getting to know a new person can be very satisfying – the newness of building a new structure from scratch in your head to represent this person’s states). Companies that interact with customers in short, anonymous relationships almost never present them with complex interactions (convenience stores, taxi drivers). With other companies we have more complex interactions and longer relationships (doctors, banks).

These transitions of state are, again, like words that make up sentences in formal languages. We all live these languages every day. How many states do you have?

Comments 2

  1. Hannu wrote:

    I remember with some nostalgia my first software job, programming a telecom switch. The software was structured as a number of state machines, and this suited the application very well.I loved state machines…It took some experience from other applications to realize that sometimes stateless design is better! I guess this is similar to get attached to a specific programming language.

    Posted 17 Jul 2009 at 4:08 am
  2. johan wrote:

    State is the only way to model some things it seems so we can’t really get away from it. The problem is that if you have N objects, each of which can be in one of M states, the number of states of the entire system increases exponentially with N. This makes the whole thing hard to verify and reason about, both for people and verification tools. It seems a good design seeks to “minimize the number of moving parts” 😉

    But of course they’re fun to think about.

    Telecom switching is cool, lots of advanced technologies seem to come out of it, like the Erlang language developed at Ericsson.

    Posted 17 Jul 2009 at 1:21 pm

Trackbacks & Pingbacks 1

  1. From Monomorphic — On statefulness on 16 Jun 2010 at 8:25 am

    […] year I made some attempts at free association around formal languages and state machines. But at that time, not much was said about the idea of a state itself; an idea […]

Post a Comment

Your email is never published nor shared. Required fields are marked *