Skip to content

Latest commit

 

History

History
272 lines (167 loc) · 6.91 KB

life-beyond-relational-db.org

File metadata and controls

272 lines (167 loc) · 6.91 KB

Life Beyond Relational Database - Event Sourcing in Haskell

@abailly on twitter

arnaud@igitur.io

http://igitur.io

Forewords

“You don’t need static type checking if you have 100% unit test coverage.”

“Uncle Bob” Martin - May 2016 http://blog.cleancoder.com/uncle-bob/2016/05/01/TypeWars.html

Forewords

“You don’t need static type checking if you have 100% unit test coverage.”

“Uncle Bob” Martin - May 2016 http://blog.cleancoder.com/uncle-bob/2016/05/01/TypeWars.html

WAT?

Introduction

  • Thanks to nCrafts team for giving me space and time to talk about things I love amongst so many people I admire

Introduction

  • Thanks to nCrafts team for giving me space and time to talk about things I love amongst so many people I admire
  • This draws on the past 2 years’ experience developing a peer-to-peer platform at Capital Match based on those techniques (see http://www.capital-match.com)

Introduction

  • Thanks to nCrafts team for giving me space and time to talk about things I love amongst so many people I admire
  • This draws on the past 2 years’ experience developing a peer-to-peer platform at Capital Match based on those techniques (see http://www.capital-match.com)
  • I assume knowledge of TDD, DDD and Event Sourcing terminology

Introduction

  • Thanks to nCrafts team for giving me space and time to talk about things I love amongst so many people I admire
  • This draws on the past 2 years’ experience developing a peer-to-peer platform at Capital Match based on those techniques (see http://www.capital-match.com)
  • I assume knowledge of TDD, DDD and Event Sourcing
  • This is pretty much a permanent work-in-progress

Introduction

  • Thanks to nCrafts team for giving me space and time to talk about things I love amongst so many people I admire
  • This draws on the past 2 years’ experience developing a peer-to-peer platform at Capital Match based on those techniques (see http://www.capital-match.com)
  • I assume knowledge of TDD, DDD and Event Sourcing
  • This is pretty much a permanent work-in-progress

    Feedback welcomed

Goal(s)

To share experience on implementing a real-world system using only purely functional tools and techniques

Goal(s)

To share experience on implementing a real-world system using only purely functional tools and techniques

To offer some evidence strongly typed functional programs are a perfect fit for modern software design techniques

Goal(s)

To share experience on implementing a real-world system using only purely functional tools and techniques

To offer some evidence strongly typed functional programs are a perfect fit for modern software design techniques

To further personal plans towards worldwide Haskell and Emacs domination

Goal(s)

To share experience on implementing a real-world system using only purely functional tools and techniques

To offer some evidence strongly typed functional programs are a perfect fit for modern software design techniques

To further personal plans towards worldwide Haskell and Emacs domination

To have some fun

Caveats

  • (lot of) Strongly Typed Haskell Code Inside

Caveats

  • (lot of) Strongly Typed Haskell Code Inside
  • Not sure how much is understandable or even meaningful…

Caveats

  • (lot of) Strongly Typed Haskell Code Inside
  • Not sure how much is understandable or even meaningful…
  • Or this might be so obvious as not being worthy of notice…

Caveats

  • (lot of) Strongly Typed Haskell Code Inside
  • Not sure how much is understandable or even meaningful…
  • Or this might be so obvious as not being worthy of notice…

    Feedback welcomed

A Simple Event Sourced Service from Scratch

  • A counter service:
    • Initial value is 0
    • Can increment counter with a positive value
    • Can decrement counter with a positive value
    • Can query state of the counter
    • Counter’s value can not go below 0 or above 100

What’s been demoed

  • TDD w/ Property Based Testing
  • Purely functional model event sourced model
  • Services defined from composable effectful building blocks
  • Statically typed REST API w/ Servant (http://haskell-servant.github.io/)
  • Use the REPL, Luke!

Really getting Out of the Tar Pit

  • Divide quod impera

Really getting Out of the Tar Pit

  • Divide quod impera
  • Domain-focused language(s) -> aka. Ubiquitous language

Really getting Out of the Tar Pit

  • Divide quod impera
  • Domain-focused language(s) -> aka. Ubiquitous language
  • Bounded contexts -> Small self-contained domain-centric services

Really getting Out of the Tar Pit

  • Divide quod impera
  • Domain-focused language(s) -> aka. Ubiquitous language
  • Bounded contexts -> Small self-contained domain-centric services
  • Hexagonal architecture -> Side-effects free business domain model composed within effectful context

Really getting Out of the Tar Pit

  • Divide quod impera
  • Domain-focused language(s) -> aka. Ubiquitous language
  • Bounded contexts -> Small self-contained domain-centric services
  • Hexagonal architecture -> Side-effects free business domain model composed within effectful context
  • Event Sourcing -> Immutable stream of events as the state of the system

Takeaways

  • It’s easy to define languages and pure models and to play with them

Takeaways

  • It’s easy to define languages and pure models and to play with them
  • Strong typing helps enforcing guarantees at all levels

Takeaways

  • It’s easy to define languages and pure models and to play with them
  • Strong typing helps enforcing guarantees at all levels
  • It’s easy to test drive model with properties

Takeaways

  • It’s easy to define languages and pure models and to play with them
  • Strong typing helps enforcing guarantees at all levels
  • It’s easy to test drive model with properties
  • Sophisticated type features makes it possible to define and compose DSL fragments

Some Interesting References