Thursday, January 13, 2022

We're All Actors on the Stage of Life

Acting!

Yes, you read that right. You, my friend, are an actor. So am I. "But!" I hear you say, "I'm not making Hollywood bucks!" I'll commiserate with you. Neither am I. And, yet, I maintain that we are all actors.

No, I'm not talking about how we fake it 'til we make it, imposter syndrome and all. I mean that we are all part of systems and act upon that system. While you can argue that some do so more effectively than others, we're all actors in a variety of systems. At home, you may be a parental actor. At work, you may be a manager or, more likely, a developer. In the world, you may be a more or less active part of a government by the people, at least in democratic nations. 


Oh, Behave!

I belabor that point to underscore that you already know how actors behave. First, importantly, they behave according to rules set out by the system in which they participate. Next, they behave consistently or they are considered suspect by the others participating in the system. In hierarchical systems, they often have a supervisor that can correct or dismiss them if they go astray.

The next thing to note about actors is that they are often busy executing upon those established behaviors. They're not usually waiting around to be told what to do. Rather, someone can ask them to do something and it gets prioritized against the other tasks they are already working. 

Now, let's dig into that. If you ask someone to do something, if it's a nearly instantaneous result then you might wait around for that result. Otherwise, you'd make the request and go on with your own activities while trusting that they'll get the result back to you, if such is needed, when it is ready. The only distinction between that and telling someone to do something is politeness. 


Revisiting the Coffee Shop

Now, let's say that you're not the only actor in the system who can handle the request. Leveraging my last example of a coffee shop, you're working the register and have 2 baristas in your coffee shop. As you take another customer's order, rather than ask one barista to make the order, being told that they're too busy, and then asking the other, you simply tell the baristas that an order is waiting to be filled. You may recall that this is called being message-driven and that you probably tell them via a ticketing system. One of them, when they're available, then takes the next order in the queue and fulfills it. 

So, that's it! You are now refreshed on actors. I say refreshed because you already knew all this but just hadn't had it contextualized. Hello, Actor! It's nice to meet a fellow Actor!


Like, wait a minute.

Oh, I see what you're saying. As a fellow software engineer, what does this have to do with us? I got you...in my next post (which I promise will be in the next few days, not next few months).

Mocking GCP APIs containing iterator structs

New company & language, who dis? The astute amongst my readers may have noticed that I left Lightbend to go work with some friends who ...