ElixirConf 2017 - Perhap: Applying Domain Driven Design and Reactive Architectures to Functional Programming - by @Version2beta
Perhap is a framework for building reactive applications in a Domain Driven Design (DDD) context, which makes it both opinionated in how you design your system, and highly efficient in how you implement it.
- As an event store, Perhap receives events, persists them to Riak, Cassandra, or DynamoDB, and delivers them to consumers over HTTP or a message bus.
- As a DDD application framework, Perhap extends that event store to route events to registered domain services implemented as pure functions (reducers), receive back domain models, and answer queries about entities or allow clients to subscribe to changes in an entity model.
Between these two use cases, Perhap provides a foundation for application development that focuses our attention on domain modeling and our development efforts on the front end and business logic only. We use the core concepts from Domain Driven Design to model our bounded context, entities, events, and models, all enforced by the framework. We get the benefits of a fully reactive architecture for free. Perhap fits extremely well with the Redux store, event, action pattern, or with the Elm model, update, view, subscribe architecture.
This talk focuses on why and how we’ve used Domain Driven Design to improve our design and architecture in a functional programming environment (specifically using Elixir), how the Reactive Manifesto influenced our choices, and how the product of that work, Perhap, can be used to quickly develop applications using those patterns. We’ll walk through a simple application built on Perhap.
As of May 28th, we’ve built three versions of Perhap - two proofs of concept, and an implementation as a production app that doesn’t break a sweat supporting 17,000 users generating a hundred thousand events a day for a Fortune 250 sportswear giant. The open source refactor is not production ready, but will be either ready or close to ready by ElixirConf.
- The seminal book on Domain Driven Design (object oriented focus)
- Domain Driven Design platform written in and for Elixir
- Free eBook on reactive microservices by Oreilly
- Domain Modeling Made Functional (uses F#)
- The rDDD (reactive domain driven design) framework that implements the ideas in this talk