concurrent

How to use multiple Futures in a Scala for-comprehension alvin August 3, 2017 - 1:18pm
Table of Contents1 - The correct approach (simplified)2 - A thorough example for verification3 - The wrong approach4 - Summary

If you want to create multiple Scala Futures and merge their results together to get a result in a for comprehension, the correct approach is to (a) first create the futures, (b) merge their results in a for comprehension, then (c) extract the result using onComplete or a similar technique.

In Erlang, processes share no memory and interact only by sending messages alvin June 18, 2017 - 11:28am

“In Erlang, processes share no memory and can interact with each other only by sending messages. This is exactly how objects in the real world behave.”

Erlang: Processes interact by one method: exchanging messages alvin June 18, 2017 - 11:25am

“Processes interact by one method, and one method only, by exchanging messages. Processes share no data with other processes. This is the reason why we can easily distribute Erlang programs over multicores or networks.”

Joe Armstrong, in his book,
Programming Erlang: Software for a Concurrent World

In Erlang, it’s OK to mutate state within an individual process alvin June 18, 2017 - 11:19am

“In Erlang (Akka), it’s OK to mutate state within an individual process (actor), but not for one process to tinker with the state of another process.”

Joe Armstrong: Grow software apps by adding small communicating objects

We should grow things (software applications) by adding more small communicating objects, rather than making larger and larger non-communicating objects.

Concentrating on the communication provides a higher level of abstraction than concentrating on the function APIs used within the system. Black-box equivalence says that two systems are equivalent if they cannot be distinguished by observing their communication patterns. Two black-boxes are equivalent if they have identical input/output behavior.

When we connect black boxes together we don't care what programming languages have been used inside the black boxes, we don't care how the code inside the black boxes has been organized, we just have to obey the communication protocols.

Erlang programs are the exception. Erlang programs are intentionally structured as communicating processes — they are the ultimate micro-services.

Large Erlang applications have a flat “bus like” structure. They are structured as independent parallel applications hanging off a common communication bus. This leads to architectures that are easy to understand and debug and collaborations which are easy to program.

~ From this post by Joe Armstrong, author of the book Programming Erlang: Software for a Concurrent World