Functional Web Development with Elixir, OTP, and Phoenix: Rethink the Modern Web App

Lance Halvorsen

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2018-03-06
  • 定價: $1,600
  • 售價: 9.0$1,440
  • 語言: 英文
  • 頁數: 220
  • 裝訂: Paperback
  • ISBN: 1680502433
  • ISBN-13: 9781680502435
  • 相關分類: Functional-programming
  • 立即出貨 (庫存=1)

買這商品的人也買了...

商品描述

Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web applications. Make the most of them as you build a stateful web app with Elixir and OTP. Model domain entities without an ORM or a database. Manage server state and keep your code clean with OTP Behaviours. Layer on a Phoenix web interface without coupling it to the business logic. Open doors to powerful new techniques that will get you thinking about web development in fundamentally new ways.

Elixir and OTP give us exceptional tools to build stateful back-end applications that really scale, with rock-solid reliability. In this book, you'll build a web application in ways that are radically different from the norm. The back end will be stateful, not stateless. Use persistent connections with Phoenix Channels instead of HTTP's request-response, and create the full application in distinct, decoupled layers.

In Part 1, start by building the business logic as a separate application, without Phoenix. Model the application domain with Elixir Agents and simple data structures. By keeping state in memory instead of a database, you can reduce latency and simplify your code. Then add OTP Behaviours such as gen_server and gen_fsm that make managing in-memory state a breeze. Create a supervision tree to boost fault tolerance while separating error handling from business logic.

Phoenix is a modern web framework you can layer on top of business logic while keeping the two completely decoupled. In Part 2, you'll do exactly that as you build a web interface with Phoenix. Bring in the application from Part 1 as a dependency to a new Phoenix project. Then use ultra-scalable Phoenix Channels to establish persistent connections between the stateful server and a stateful front-end client.

You're going to love this way of building web apps!

What You Need:

You'll need a computer that can run Elixir version 1.3 or higher and Phoenix 1.2 or higher. Some familiarity with Elixir and Phoenix is recommended.

商品描述(中文翻譯)

Elixir和Phoenix作為一個無與倫比的平台,為建立現代網絡應用程序帶來了巨大的興奮。在使用Elixir和OTP建立一個有狀態的網絡應用程序時,充分利用它們。在沒有ORM或數據庫的情況下對領域實體進行建模。使用OTP行為來管理服務器狀態並保持代碼的整潔。在不將其與業務邏輯耦合的情況下添加Phoenix網絡界面。打開強大的新技術之門,讓您以根本不同的方式思考網絡開發。

Elixir和OTP為我們提供了出色的工具,用於構建可靠性極高且能夠真正擴展的有狀態後端應用程序。在本書中,您將以與常規完全不同的方式構建網絡應用程序。後端將是有狀態的,而不是無狀態的。使用Phoenix Channels的持久連接,而不是HTTP的請求-響應,並在不同的、解耦的層次上創建完整的應用程序。

在第1部分中,首先構建業務邏輯作為一個獨立的應用程序,而不使用Phoenix。使用Elixir Agents和簡單的數據結構對應用程序領域進行建模。通過將狀態保存在內存中而不是數據庫中,可以減少延遲並簡化代碼。然後添加像gen_server和gen_fsm這樣的OTP行為,使管理內存中的狀態變得輕而易舉。創建一個監督樹來提高容錯能力,同時將錯誤處理與業務邏輯分離。

Phoenix是一個現代的Web框架,您可以在業務邏輯之上添加它,同時保持兩者完全解耦。在第2部分中,您將以此方式構建一個帶有Phoenix的Web界面。將第1部分的應用程序作為依賴添加到新的Phoenix項目中。然後使用高度可擴展的Phoenix Channels在有狀態的服務器和有狀態的前端客戶端之間建立持久連接。

您將喜歡這種構建Web應用程序的方式!

您需要的是一台能運行Elixir 1.3或更高版本和Phoenix 1.2或更高版本的計算機。建議您對Elixir和Phoenix有一定的熟悉程度。