--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/b4a84df3-586d-4675-8b3c-6ae7efaa62c6n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/B82DF589-D9BB-4189-A684-8AD3D36FDA5C%40yahoo.com.
Getting back to "messaging", I think what makes it an interesting and useful concept is that it's a higher-level concept than a simple method call, even one with multiple dispatch. So maybe it's useful as a concept in some contexts (little "c" contexts) that we typically think of as object-oriented but not others. If that means that we're not really doing "object-oriented programming" in a small, simple system with nothing but synchronous method calls and relatively simple instance and role method communication, then so be it. I don't think that makes focusing on "objects", their interactions, and mental models any less useful.
In any case, it's very much worth taking the "messaging" concept and applying it to more complex systems (what Kay ultimately had in mind in the first place, it seems), especially distributed ones, and/or systems designed to maximize use of multiple processors on the same machine. Obviously there has been a lot of ground covered in this area already, and many different attempts to do this, with the actor model perhaps being the most successful.
I'm interested in exploring how asynchronous messaging could work in DCI. I've always thought of DCI on a smaller scale than a large, distributed system, and I think using DCI to represent remote web services as Contexts playing roles would be a whole research topic on its own—I'm unsure if DCI would even be an appropriate paradigm there. (It would be exciting if it did work though.)
So I started small—just a single, local program. My simple little experiment (not finished and not ready to share the code yet) is based on the xtUML model of message passing. I got a fair amount of mileage out of it at first, but ran into some limitations due to the lack of any concept of a return value: when an object receives a message and performs the requested action, the only way it has to say "I'm done" is to send a new message back to the object that called it. In a general sense that's fine (and how it should work), but I think the programming environment would need some way of distinguishing between "response messages" and regular messages. For example, suppose that the Source account role in the money transfer example looks like this:
roles: {
Source: {
transferToDestination({ amount }) {
tell(self, 'withdraw', { amount })
},
withdraw({ amount }) {
tell(self, 'decreaseBalance', { amount })
}
}
}
In the 'withdraw' role method, the account sends a
'decreaseBalance' message to itself, which is received by the
Account Context (or class, depending on the implementation), but
the Account Context doesn't have a good way of sending a message
back to the Source role—it can't do so directly because in this
asynchronous "fire-and-forget" model, that would mean breaking the
rule that role methods should only be callable by code within
their enclosing context (in other words, Contexts should be
encapsulated). One idea I came up with to solve this in a simple
way is to make a special exception for response messages:
roles: {
Source: {
responseMessageHandlers: {
increaseBalanceSucceeded({ amount }) {
tell(destination, 'deposit', { amount })
}
},
...
The environment would need to ensure that response messages can't
be sent or received where they shouldn't be—the goal is only to
allow the flow to return to the role that made the original
request.
This is all very rough and preliminary of course, but I'd be
curious to hear anyone's thoughts on this.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAJ7XQb5myhUusieA3%2BjRycCpgi3x7CRe6vht8V5vPZ4zQTrZNQ%40mail.gmail.com.
There are two other updates I wanted to share...
1. I watched a few more Alan Kay videos over the holidays. My
favorite was "Doing with
Images Makes Symbols"—really fascinating stuff, and the
article that led me to it was also interesting. But in this
video, he addresses the topic of messaging directly:
If you think about scaling... And this is what biology is partly good for—we tend to think on the scales that we live in in computing, but biology is on scales millions and millions, billions of times larger. And once you scale out, as we were thinking about in the internet, you have to get away from gear-like meshing of procedure calls and stuff and you have to go to something like messaging.
2. I read more about xtUML, and as I conjectured earlier, there's
nothing about it that forces you to make everything concurrent or
parallel. All messages are asynchronous at a conceptual level, but
in the book they give this example of a model that can be
implemented without concurrency:
Now consider a pacemaker. This application has a loosely periodic nature that can be expressed asynchronously using timed signals to assume the responsibility for detecting the nonoccurrence of certain periodic events, such as a heartbeat. There is no need for concurrency, nor a distributed network of computers. Rather, the goal is to minimize the computing hardware required so it can be implanted in the body.
A model compiler that optimized memory usage and executed on a single chip without concurrency would be ideal for this situation.
One more quote:
Similarly, Executable UML has active elements such as “signal” and “action,” and the model compiler must provide an implementation for these too. Hence, a call to a SignalTaker function could implement a signal synchronously within a single task, as could the sending and receiving of a particular kind of message between tasks.I've highlighted the examples of synchronous approaches, but of course technologies like Akka also work well for implementing xtUML signals/messages when concurrency is actually needed.
Haha yes... and how would DCI look in erlang? Not being
sarcastic; I genuinely don't know if anyone has tried this...but I
suspect it would need a little help (e.g. language extensions,
source transformation) to achieve highly readable code.
my first thought is of course to just use erlang :-)
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAJ7XQb5kYF2qsgeOtKa0c619%2Bp8%2BZgWPYkc7jjkvANXNoQjQhQ%40mail.gmail.com.
On Jan 21, 2024, at 15:32, Matthew Browne <mbro...@gmail.com> wrote:I'm interested in exploring how asynchronous messaging could work in DCI.
Here is what I found interesting about the xtUML model of concurrency...quoting from the Executable UML book:
"This view of time is similar to Einstein's relativistic view of
time. If we transmit a signal to two stars, one of which in turn
transmits a signal to our second star, it is not known which
signal will arrive at the second star first, only that if we send
two signals to a single star the signals will arrive in the order
we sent them."
One of the "rules about signals":
"No priorities. Similarly, there is no notion of signal
priority, in these rules, and a modeler cannot arbitrarily
accelerate one signal ahead of another. To do so would be
equivalent to 'going backwards in time.'"
However:
"Signals sent to self are always accepted before other signals to
that instance."
Of course, this is not the only approach in the UML space. I also
came across this
paper which combines the actor model with hierarchical state
machines, but I wonder if that's over-complicating things for most
use cases.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/93184BE5-9DFF-4877-BD66-9EA269212728%40gmail.com.
That sounds cool :) And I like the idea of a local in-memory option for debugging.
The docker containers sound quite granular (depends on the use
cases of course)...but I suppose the essential idea would still
work just as well if each docker container contained its own
little network of interacting local Contexts...?