How would you explain actors to a non-programmer? [closed]

佐手、 提交于 2019-12-02 22:39:10
  • There can be many actors. All actors act "at the same time". The concurrency is a key part of this model.

  • Actors cannot know what other Actors are thinking. The only way to move information is with a message. (no shared state)

  • Actors can receive messages, and act on them by:

    • doing computation with the data in them

    • sending messages to other actors

    • creating other actors.

    • ignoring/discarding the message.

This basically makes actors just like... People. People don't know what each other are thinking, they must send messages to convey information, they have the choice of ignoring incoming messages, considering them, or communicating with other people. Random bad things can happen to people. Lots of people all do things at the same time. To handle more load, add more people.

Regarding your masters project, I suggest finding out about the Erlang Web framework. The programming language Erlang is based on the Actor model, and is used to great effect in scalable systems including phone switches... and the Facebook messaging system.

I'll try a simple metaphor:

Actors are people doing some work inside their houses. In front of each house, there is a mailbox. In order to communicate with each other and get work done, messages are sent between the actors.

I am not sure that this will be good one, but I'll try:

Let's imagine a classic middle-east marketplace. There are buyers(suppose they are just walking tourists) and sellers. Buyers are walking through marketplace, and sellers cry out name's of theirs goods: Carpets!! Species!!! Horses!!! Сandies!!! Jewels!!! and so on... Some buyers are not interest in specific kind of goods and go to the next store, but some buyers become interested, and ask: "How much is it?", seller: "50$", buyer:"Can you give me a discount?", and so on...

Actors are buyers and sellers here. Sellers are sending messages with types of their goods. Buyer can skip a message, or can send message for asking price.

Actor - is something we can also call subject. Actors are doing something with objects. Actor is calls so, because it's somebody who acts.

I would say, "Actors are a simple way to tell computers to do more than one thing at the same time. They are different from other ways to tell computers to do more than one at the same time because they take fewer resources than some of the alternatives and because they are easier for programmers to use correctly than some of the other alternatives."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!