Functional Design and Architecture by Alexander Granin #BookSummary

Functional Design and Architecture by Alexander Granin #BookSummary

Concurrent application framework


  • Multithreading and concurrency is a difficult topic, and our goal as developers is to predict the possible problems on the design stage of development.
  • Many different problems occur in a inaccurately crafted concurrent environment: dead locks, threads starvation, resource leackage or wrong disposal.
  • Learn the difference between IORefs, MVars and STM TVars in a concurrent environment so you could consciously choose between them to design a reliable concurrent code.
  • TVars are thread-save and transactional, and also they are fundamental because you can express other data structures with them.
  • Try to organize your threads safely to avoid leakage of handlers or other concurrent problems.
  • Transactional data structures represent a data model, transactions (funtions within the STM monad) represent a behavior model.
  • Normally, bare threads should be treated as a limited resource, even if they are green.
  • Leakage of green threads is a less sharp problem than leakage of OS-specific threads, but still is not desirable from the design point of view.
  • Free monads can be your architectural pattern for constructing a general-purpose application framework.
  • Incorporating STM into the framework as an interface brings another state handling mechanism for the business logic.
  • STM on the implementation layer can and will make the framework safely concurrent.
  • Bare IO is a temptation for developers, so it’s better to put it (IO, not developers) in a straitjacket

#Booksummary

#WeekReading

Credit : Manning


要查看或添加评论,请登录

Pankaj Gajjar的更多文章

社区洞察

其他会员也浏览了