Functional Design and Architecture by Alexander Granin #BookSummary

Reactive applications

  • Reactive programming can be used to create an environment for formulas to live in and react to new data in order to produce new results.
  • The actor model helps to organize stateful applications, but there is a definite cost of making interactions between actors safe and reliable.
  • The abstracted communication protocol hides the underlying world and acts as a contract, interface, and agreement between all actors
  • MVars are a type of concurrency tool that allow threads to access a shared variable in a safe and orderly manner.
  • A specific communication protocol between actors can be implemented with the MVar request-response pattern.
  • The MVar request-response pattern is a way of using MVars to construct a remote service that works in a separate thread, waits for a request, processes it, and pushes the result back.
  • The MVar request pattern can be used to make communication between threads 100% reliable and type safe.
  • More advanced architectures may require implementing a message queue (message bus).
  • Free monadic architecture allowed us providing the third implementation for the same business logic, in addition to the real implementation and test environment.
  • MVars in general are capable of maintaining concurrency, but they may be limited in expressiveness, difficult in proper usage and a bit awkward in case the concurrent data model is big and sophisticated.
  • MVar-based concurrent models tend to become overcomplicated when growing in size.
  • Switching to STM will be a nice idea when dealing with MVars starts being overly difficult.

#Booksummary

#WeekReading

Credit : Manning


To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics