[obsolete] Fibonacci function: An example of how to write concurrent programs without multi-threading
FMP 2 focuses on local services that run concurrently to each other while FMP 3 focuses on distributed services that work together seamlessly. And uses of these services are sharing a unified API and programming model.
M123 is a first demo about FMP 3. The demo contains three standalone programs: M1.java, M2.java, and M3.java. The setup around them is illustrated by figure 1.
The coming FMP 3.0 provides the same API to invoke local and distributed messengers each of which may be running on a different computer and/or written in a different language.
Fast Messenger Programming (FMP) introduces two types of objects. Active objects are designed to represent business logics while messenger objects are designed to support active objects on underlying programming languages. As Figure 1 illustrates, messenger objects are native objects written using the underlying programming language. Active objects, on the other hand, are virtual objects.
In previous tutorials, we have introduced that an active object behaves like an human individual who takes jobs and executes them one at a time from his private FIFO inbox. It means for a user program that the most straightforward way to invoke a service on an active object would be placing a request in the inbox of the target active object.
We introduced a new visual element (see figure 1) that can be used to represent active objects in your mind and/or on a diagram along with other visual elements of classes, objects, human actors, etc. They are very appropriate for expressing high-level designs or conceptual models.
FMP is a very flexible programming model. You can use it as simple as injecting just a single active object into your existing application. You would be able to do so after read a few API docs. However, if you like to master FMP and unleash its full potential, you would be better able to effectively think in active object as if it is one of your native thought elements.
In the last tutorial, we introduced a FMP program that contains an active object "calculator" for any user program that wants a product from two big integers. In this tutorial, we will address concerns some FMP beginners might have. For example, why don’t we get a product of n1 and n2 by using less code?
new Calculator ().multiply (n1, n2);
FMP stands for Fast Messenger Programming a new object-based general programming model for concurrent programming with no threads.
In this tutorial, we examine a minimal set of FMP elements and how they are structured and interacted in a working FMP program.