Explain "Active-object" pattern

9.2k Views Asked by At

What is the goal of the Active object pattern? Can you show me any abstract example to understand it easily?

1

There are 1 best solutions below

7
On

The patern's static object diagram

The Active object pattern's goal is to separate the method calling from method execution. It is like a waiter in a restaurant, who just hands the orders from the customers to the chef.

When a customer orders some food from the waiter

the customer is the Client, the waiter is the Proxy

he writes it up on a paper (obviously doesn't start to cook it),

the paper is the MethodRequest, the table's number on the paper is the Future object

gives the paper to the chef, who decides which cook should prepare it (who has time).

the chef is the Scheduler who has a list of papers (ActivationList) and the cooks are the Servant-s

When the meal is ready, the cook places it on the serve bar and the waiter brings it to the customers table.

Client reads the method's result, from the Result object.